From f17c2b98ca39a9fa5db5c14c1f72c8c232303651 Mon Sep 17 00:00:00 2001 From: hemirt Date: Mon, 26 Mar 2018 21:14:27 +0200 Subject: [PATCH] ignore undesirable users' messages --- src/providers/twitch/ircmessagehandler.cpp | 4 +++- src/providers/twitch/twitchchannel.cpp | 3 ++- src/providers/twitch/twitchserver.cpp | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/providers/twitch/ircmessagehandler.cpp b/src/providers/twitch/ircmessagehandler.cpp index 796f048d5..4a882b11b 100644 --- a/src/providers/twitch/ircmessagehandler.cpp +++ b/src/providers/twitch/ircmessagehandler.cpp @@ -11,6 +11,7 @@ #include "singletons/windowmanager.hpp" #include +#include using namespace chatterino::singletons; using namespace chatterino::messages; @@ -159,7 +160,8 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) twitch::TwitchMessageBuilder builder(c, message, message->parameter(1), args); - if (!builder.isIgnored()) { + const static std::vector vec{"airbrushgrenade", "scizth0"}; + if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), message->nick()) == vec.end()) { messages::MessagePtr _message = builder.build(); if (_message->flags & messages::Message::Highlighted) { TwitchServer::getInstance().mentionsChannel->addMessage(_message); diff --git a/src/providers/twitch/twitchchannel.cpp b/src/providers/twitch/twitchchannel.cpp index cdb16af8a..b68dc06a5 100644 --- a/src/providers/twitch/twitchchannel.cpp +++ b/src/providers/twitch/twitchchannel.cpp @@ -310,7 +310,8 @@ void TwitchChannel::fetchRecentMessages() messages::MessageParseArgs args; twitch::TwitchMessageBuilder builder(channel, privMsg, args); - if (!builder.isIgnored()) { + const static std::vector vec{"airbrushgrenade", "scizth0"}; + if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), privMsg->nick()) == vec.end()) { messages.push_back(builder.build()); } } diff --git a/src/providers/twitch/twitchserver.cpp b/src/providers/twitch/twitchserver.cpp index aec19a32e..bb57212a0 100644 --- a/src/providers/twitch/twitchserver.cpp +++ b/src/providers/twitch/twitchserver.cpp @@ -90,7 +90,8 @@ void TwitchServer::privateMessageReceived(IrcPrivateMessage *message) TwitchMessageBuilder builder(chan.get(), message, args); - if (!builder.isIgnored()) { + const static std::vector vec{"airbrushgrenade", "scizth0"}; + if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), message->nick()) == vec.end()) { messages::MessagePtr _message = builder.build(); if (_message->flags & messages::Message::Highlighted) { TwitchServer::getInstance().mentionsChannel->addMessage(_message);