reformat/cleanup

This commit is contained in:
Rasmus Karlsson 2018-03-30 12:37:00 +02:00
parent 95878dc7db
commit ea21aa5dea
3 changed files with 23 additions and 19 deletions

View file

@ -59,6 +59,6 @@ private:
messages::LimitedQueue<messages::MessagePtr> messages; messages::LimitedQueue<messages::MessagePtr> messages;
}; };
typedef std::shared_ptr<Channel> ChannelPtr; using ChannelPtr = std::shared_ptr<Channel>;
} // namespace chatterino } // namespace chatterino

View file

@ -265,15 +265,20 @@ void TwitchChannel::fetchRecentMessages()
return; return;
} }
TwitchChannel *channel = dynamic_cast<TwitchChannel *>(shared.get()); auto channel = dynamic_cast<TwitchChannel *>(shared.get());
assert(channel != nullptr);
static auto readConnection = channel->readConnecetion; static auto readConnection = channel->readConnecetion;
auto msgArray = obj.value("messages").toArray(); QJsonArray msgArray = obj.value("messages").toArray();
if (msgArray.size() > 0) { if (msgArray.empty()) {
return;
}
std::vector<messages::MessagePtr> messages; std::vector<messages::MessagePtr> messages;
for (int i = 0; i < msgArray.size(); i++) { for (const QJsonValueRef _msg : msgArray) {
QByteArray content = msgArray[i].toString().toUtf8(); QByteArray content = _msg.toString().toUtf8();
auto msg = Communi::IrcMessage::fromData(content, readConnection); auto msg = Communi::IrcMessage::fromData(content, readConnection);
auto privMsg = static_cast<Communi::IrcPrivateMessage *>(msg); auto privMsg = static_cast<Communi::IrcPrivateMessage *>(msg);
@ -284,7 +289,6 @@ void TwitchChannel::fetchRecentMessages()
} }
} }
channel->addMessagesAtStart(messages); channel->addMessagesAtStart(messages);
}
}); });
} }

View file

@ -20,7 +20,7 @@ class TwitchChannel final : public Channel
QTimer *chattersListTimer; QTimer *chattersListTimer;
public: public:
~TwitchChannel(); ~TwitchChannel() final;
void reloadChannelEmotes(); void reloadChannelEmotes();