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;
};
typedef std::shared_ptr<Channel> ChannelPtr;
using ChannelPtr = std::shared_ptr<Channel>;
} // namespace chatterino

View file

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

View file

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