Hide chatter list button for non-moderators (#5245)
This commit is contained in:
@@ -653,23 +653,40 @@ std::vector<MessagePtr> IrcMessageHandler::parseMessageWithReply(
|
||||
void IrcMessageHandler::handlePrivMessage(Communi::IrcPrivateMessage *message,
|
||||
TwitchIrcServer &server)
|
||||
{
|
||||
// This is for compatibility with older Chatterino versions. Twitch didn't use
|
||||
// to allow ZERO WIDTH JOINER unicode character, so Chatterino used ESCAPE_TAG
|
||||
// instead.
|
||||
// See https://github.com/Chatterino/chatterino2/issues/3384 and
|
||||
// https://mm2pl.github.io/emoji_rfc.pdf for more details
|
||||
|
||||
this->addMessage(
|
||||
message, channelOrEmptyByTarget(message->target(), server),
|
||||
message->content().replace(COMBINED_FIXER, ZERO_WIDTH_JOINER), server,
|
||||
false, message->isAction());
|
||||
|
||||
auto chan = channelOrEmptyByTarget(message->target(), server);
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get());
|
||||
|
||||
if (twitchChannel != nullptr)
|
||||
{
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
if (message->tag("user-id") == currentUser->getUserId())
|
||||
{
|
||||
auto badgesTag = message->tag("badges");
|
||||
if (badgesTag.isValid())
|
||||
{
|
||||
auto parsedBadges = parseBadges(badgesTag.toString());
|
||||
twitchChannel->setMod(parsedBadges.contains("moderator"));
|
||||
twitchChannel->setVIP(parsedBadges.contains("vip"));
|
||||
twitchChannel->setStaff(parsedBadges.contains("staff"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is for compatibility with older Chatterino versions. Twitch didn't use
|
||||
// to allow ZERO WIDTH JOINER unicode character, so Chatterino used ESCAPE_TAG
|
||||
// instead.
|
||||
// See https://github.com/Chatterino/chatterino2/issues/3384 and
|
||||
// https://mm2pl.github.io/emoji_rfc.pdf for more details
|
||||
this->addMessage(
|
||||
message, chan,
|
||||
message->content().replace(COMBINED_FIXER, ZERO_WIDTH_JOINER), server,
|
||||
false, message->isAction());
|
||||
|
||||
if (message->tags().contains(u"pinned-chat-paid-amount"_s))
|
||||
{
|
||||
auto ptr = TwitchMessageBuilder::buildHypeChatMessage(message);
|
||||
|
||||
Reference in New Issue
Block a user