ignore undesirable users' messages

This commit is contained in:
hemirt 2018-03-26 21:14:27 +02:00
parent 5c7af334ca
commit f17c2b98ca
3 changed files with 7 additions and 3 deletions

View file

@ -11,6 +11,7 @@
#include "singletons/windowmanager.hpp" #include "singletons/windowmanager.hpp"
#include <memory> #include <memory>
#include <algorithm>
using namespace chatterino::singletons; using namespace chatterino::singletons;
using namespace chatterino::messages; using namespace chatterino::messages;
@ -159,7 +160,8 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
twitch::TwitchMessageBuilder builder(c, message, message->parameter(1), args); twitch::TwitchMessageBuilder builder(c, message, message->parameter(1), args);
if (!builder.isIgnored()) { const static std::vector<QString> vec{"airbrushgrenade", "scizth0"};
if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), message->nick()) == vec.end()) {
messages::MessagePtr _message = builder.build(); messages::MessagePtr _message = builder.build();
if (_message->flags & messages::Message::Highlighted) { if (_message->flags & messages::Message::Highlighted) {
TwitchServer::getInstance().mentionsChannel->addMessage(_message); TwitchServer::getInstance().mentionsChannel->addMessage(_message);

View file

@ -310,7 +310,8 @@ void TwitchChannel::fetchRecentMessages()
messages::MessageParseArgs args; messages::MessageParseArgs args;
twitch::TwitchMessageBuilder builder(channel, privMsg, args); twitch::TwitchMessageBuilder builder(channel, privMsg, args);
if (!builder.isIgnored()) { const static std::vector<QString> vec{"airbrushgrenade", "scizth0"};
if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), privMsg->nick()) == vec.end()) {
messages.push_back(builder.build()); messages.push_back(builder.build());
} }
} }

View file

@ -90,7 +90,8 @@ void TwitchServer::privateMessageReceived(IrcPrivateMessage *message)
TwitchMessageBuilder builder(chan.get(), message, args); TwitchMessageBuilder builder(chan.get(), message, args);
if (!builder.isIgnored()) { const static std::vector<QString> vec{"airbrushgrenade", "scizth0"};
if (!builder.isIgnored() && std::find(vec.begin(), vec.end(), message->nick()) == vec.end()) {
messages::MessagePtr _message = builder.build(); messages::MessagePtr _message = builder.build();
if (_message->flags & messages::Message::Highlighted) { if (_message->flags & messages::Message::Highlighted) {
TwitchServer::getInstance().mentionsChannel->addMessage(_message); TwitchServer::getInstance().mentionsChannel->addMessage(_message);