Refactored emote reloading (#2857)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-06-20 00:11:06 +02:00
committed by GitHub
parent 74960bf419
commit d6b5921a0e
5 changed files with 92 additions and 67 deletions
+11 -6
View File
@@ -494,7 +494,16 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
{
auto app = getApp();
auto currentUser = getApp()->accounts->twitch.getCurrent();
// set received emote-sets, used in TwitchAccount::loadUserstateEmotes
bool emoteSetsChanged = currentUser->setUserstateEmoteSets(
message->tag("emote-sets").toString().split(","));
if (emoteSetsChanged)
{
currentUser->loadUserstateEmotes();
}
QString channelName;
if (!trimChannelName(message->parameter(0), channelName))
@@ -502,7 +511,7 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
return;
}
auto c = app->twitch.server->getChannelOrEmpty(channelName);
auto c = getApp()->twitch.server->getChannelOrEmpty(channelName);
if (c->isEmpty())
{
return;
@@ -529,10 +538,6 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
tc->setMod(_mod == "1");
}
}
// handle emotes
app->accounts->twitch.getCurrent()->loadUserstateEmotes(
message->tag("emote-sets").toString().split(","));
}
void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)