From 3ddac8b12a7ecda6caeae9bc69b25c7f86df41d6 Mon Sep 17 00:00:00 2001 From: moe-ka Date: Wed, 27 Feb 2019 18:30:26 +0000 Subject: [PATCH] More accurate name for flag (MessageFlag::DoNotLog), disable logging for sent whispers. --- src/common/Channel.cpp | 2 +- src/controllers/commands/CommandController.cpp | 7 +++++-- src/messages/Message.hpp | 2 +- src/providers/twitch/IrcMessageHandler.cpp | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index bcefd5f16..c9cdd6923 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -72,7 +72,7 @@ void Channel::addMessage(MessagePtr message, } // FOURTF: change this when adding more providers - if (this->isTwitchChannel() && !overridingFlags->has(MessageFlag::Whisper)) + if (this->isTwitchChannel() && !overridingFlags->has(MessageFlag::DoNotLog)) { app->logging->addMessage(this->name_, message); } diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index e244a54b2..e93a40c68 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -206,11 +206,14 @@ QString CommandController::execCommand(const QString &textNoEmoji, app->twitch.server->sendMessage("jtv", text); + auto overrideFlags = boost::optional(messagexD->flags); + overrideFlags->set(MessageFlag::DoNotLog); + if (getSettings()->inlineWhispers) { app->twitch.server->forEachChannel( - [&messagexD](ChannelPtr _channel) { - _channel->addMessage(messagexD); + [&messagexD, &overrideFlags](ChannelPtr _channel) { + _channel->addMessage(messagexD, overrideFlags); }); } diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 00b04b362..c8efc73d6 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -27,7 +27,7 @@ enum class MessageFlag : uint16_t { Untimeout = (1 << 10), PubSub = (1 << 11), Subscription = (1 << 12), - Whisper = (1 << 13), + DoNotLog = (1 << 13), AutoMod = (1 << 14), RecentMessage = (1 << 15), }; diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 759ff0ea3..34e1d08f4 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -261,12 +261,12 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) auto overrideFlags = boost::optional(_message->flags); overrideFlags->set(MessageFlag::DoNotTriggerNotification); - overrideFlags->set(MessageFlag::Whisper); + overrideFlags->set(MessageFlag::DoNotLog); if (getSettings()->inlineWhispers) { app->twitch.server->forEachChannel( - [_message, overrideFlags](ChannelPtr channel) { + [&_message, &overrideFlags](ChannelPtr channel) { channel->addMessage(_message, overrideFlags); // }); }