diff --git a/CHANGELOG.md b/CHANGELOG.md index 540e2ff3..33c6fed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Minor: Adjust large stream thumbnail to 16:9 (#3655) - Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623) - Minor: Add information about the user's operating system in the About page. (#3663) -- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643) +- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716) - Minor: Added chatter count for each category in viewer list. (#3683) - Minor: Sorted usernames in /vips message to be case-insensitive. (#3696) - Minor: Added option to open a user's chat in a new tab from the usercard profile picture context menu. (#3625) diff --git a/src/Application.cpp b/src/Application.cpp index 3be36ae3..67c70e9e 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -332,23 +332,14 @@ void Application::initPubSub() }); }); - const auto handleAutoModMessage = [&](const auto &action) { - auto chan = this->twitch->getChannelOrEmptyByID(action.roomID); - - if (chan->isEmpty()) - { - return; - } - - postToThread([chan, action] { - const auto p = makeAutomodMessage(action); - chan->addMessage(p.first); - chan->addMessage(p.second); - }); - }; - this->twitch->pubsub->signals_.moderation.autoModMessageCaught.connect( [&](const auto &msg, const QString &channelID) { + auto chan = this->twitch->getChannelOrEmptyByID(channelID); + if (chan->isEmpty()) + { + return; + } + switch (msg.type) { case PubSubAutoModQueueMessage::Type::AutoModCaughtMessage: { @@ -415,7 +406,11 @@ void Application::initPubSub() action.target = ActionUser{msg.senderUserID, msg.senderUserLogin, senderDisplayName, senderColor}; - handleAutoModMessage(action); + postToThread([chan, action] { + const auto p = makeAutomodMessage(action); + chan->addMessage(p.first); + chan->addMessage(p.second); + }); } // "ALLOWED" and "DENIED" statuses remain unimplemented // They are versions of automod_message_(denied|approved) but for mods. @@ -430,7 +425,19 @@ void Application::initPubSub() }); this->twitch->pubsub->signals_.moderation.autoModMessageBlocked.connect( - handleAutoModMessage); + [&](const auto &action) { + auto chan = this->twitch->getChannelOrEmptyByID(action.roomID); + if (chan->isEmpty()) + { + return; + } + + postToThread([chan, action] { + const auto p = makeAutomodMessage(action); + chan->addMessage(p.first); + chan->addMessage(p.second); + }); + }); this->twitch->pubsub->signals_.moderation.automodUserMessage.connect( [&](const auto &action) {