From 1a1d0f305c3e4b095cd12da162bc46641e2ecb25 Mon Sep 17 00:00:00 2001 From: hemirt Date: Wed, 20 Mar 2019 20:46:20 +0100 Subject: [PATCH] make whispers not disabled on clear --- src/common/Channel.cpp | 3 ++- src/common/Channel.hpp | 2 +- src/controllers/commands/CommandController.cpp | 1 + src/messages/Message.hpp | 3 ++- src/messages/layouts/MessageLayoutContainer.hpp | 2 +- src/providers/twitch/IrcMessageHandler.cpp | 1 + src/widgets/helper/ChannelView.hpp | 2 +- 7 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 8d247cf2f..c34929620 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -179,7 +179,8 @@ void Channel::disableAllMessages() for (int i = 0; i < snapshotLength; i++) { auto &message = snapshot[i]; - if (message->flags.hasAny({MessageFlag::System, MessageFlag::Timeout})) + if (message->flags.hasAny({MessageFlag::System, MessageFlag::Timeout, + MessageFlag::Whisper})) { continue; } diff --git a/src/common/Channel.hpp b/src/common/Channel.hpp index 9e111aa46..7bb2d299f 100644 --- a/src/common/Channel.hpp +++ b/src/common/Channel.hpp @@ -15,7 +15,7 @@ namespace chatterino { struct Message; using MessagePtr = std::shared_ptr; -enum class MessageFlag : uint16_t; +enum class MessageFlag : uint32_t; using MessageFlags = FlagsEnum; class Channel : public std::enable_shared_from_this diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 8d98a999a..805a1d731 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -200,6 +200,7 @@ QString CommandController::execCommand(const QString &textNoEmoji, } b->flags.set(MessageFlag::DoNotTriggerNotification); + b->flags.set(MessageFlag::Whisper); auto messagexD = b.release(); app->twitch.server->whispersChannel->addMessage(messagexD); diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index c8efc73d6..cdbb2a8d3 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -12,7 +12,7 @@ namespace chatterino { class MessageElement; -enum class MessageFlag : uint16_t { +enum class MessageFlag : uint32_t { None = 0, System = (1 << 0), Timeout = (1 << 1), @@ -30,6 +30,7 @@ enum class MessageFlag : uint16_t { DoNotLog = (1 << 13), AutoMod = (1 << 14), RecentMessage = (1 << 15), + Whisper = (1 << 16) }; using MessageFlags = FlagsEnum; diff --git a/src/messages/layouts/MessageLayoutContainer.hpp b/src/messages/layouts/MessageLayoutContainer.hpp index e248038a3..112f2bb3c 100644 --- a/src/messages/layouts/MessageLayoutContainer.hpp +++ b/src/messages/layouts/MessageLayoutContainer.hpp @@ -14,7 +14,7 @@ class QPainter; namespace chatterino { -enum class MessageFlag : uint16_t; +enum class MessageFlag : uint32_t; using MessageFlags = FlagsEnum; struct Margin { diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 27df7cb8c..8b9023ea6 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -248,6 +248,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) if (!builder.isIgnored()) { + builder->flags.set(MessageFlag::Whisper); MessagePtr _message = builder.build(); app->twitch.server->lastUserThatWhisperedMe.set(builder.userName); diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index 4fa8dd53c..70b5fd0b4 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -25,7 +25,7 @@ using ChannelPtr = std::shared_ptr; struct Message; using MessagePtr = std::shared_ptr; -enum class MessageFlag : uint16_t; +enum class MessageFlag : uint32_t; using MessageFlags = FlagsEnum; class MessageLayout;