mirror of
https://github.com/Chatterino/chatterino2.git
synced 2026-08-24 02:24:18 -05:00
eventsub: add some logging when privileges change (#7143)
This commit is contained in:
@@ -402,6 +402,7 @@ void IrcMessageHandler::parsePrivMessageInto(
|
||||
auto badgesTag = message->tag("badges");
|
||||
if (badgesTag.isValid())
|
||||
{
|
||||
// TODO: We should not update mod or vip status from recent messages
|
||||
auto parsedBadges = parseBadges(badgesTag.toString());
|
||||
channel->setMod(parsedBadges.contains("moderator") ||
|
||||
parsedBadges.contains("lead_moderator"));
|
||||
|
||||
@@ -127,6 +127,10 @@ TwitchChannel::TwitchChannel(const QString &name)
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->getAccounts()->twitch.currentUserAboutToChange,
|
||||
[this](const auto & /*oldAccount*/, const auto & /*newAccount*/) {
|
||||
qCDebug(chatterinoTwitchEventSub)
|
||||
<< "Current user about to change, drop all eventsub handles in "
|
||||
"preparation"
|
||||
<< this->roomId();
|
||||
this->eventSubChannelChatUserMessageHoldHandle.reset();
|
||||
this->eventSubChannelChatUserMessageUpdateHandle.reset();
|
||||
this->eventSubChannelModerateHandle.reset();
|
||||
@@ -1576,6 +1580,9 @@ void TwitchChannel::refreshPubSub()
|
||||
|
||||
if (currentAccount->isAnon())
|
||||
{
|
||||
qCDebug(chatterinoTwitchEventSub)
|
||||
<< "Current account is anon - drop all privileged eventsub handles"
|
||||
<< this->roomId();
|
||||
this->eventSubChannelModerateHandle.reset();
|
||||
this->eventSubAutomodMessageHoldHandle.reset();
|
||||
this->eventSubAutomodMessageUpdateHandle.reset();
|
||||
@@ -1590,6 +1597,10 @@ void TwitchChannel::refreshPubSub()
|
||||
|
||||
if (this->hasModRights())
|
||||
{
|
||||
qCDebug(chatterinoTwitchEventSub)
|
||||
<< "Current account is mod - subscribe to privileged eventsub "
|
||||
"handles"
|
||||
<< this->roomId();
|
||||
this->eventSubChannelModerateHandle =
|
||||
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
|
||||
.subscriptionType = "channel.moderate",
|
||||
@@ -1681,6 +1692,10 @@ void TwitchChannel::refreshPubSub()
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(chatterinoTwitchEventSub)
|
||||
<< "Current account is no longer a moderator - drop privileged "
|
||||
"eventsub handles"
|
||||
<< this->roomId();
|
||||
this->eventSubChannelModerateHandle.reset();
|
||||
this->eventSubAutomodMessageHoldHandle.reset();
|
||||
this->eventSubAutomodMessageUpdateHandle.reset();
|
||||
|
||||
Reference in New Issue
Block a user