From f2eabacda1516721b3a65c644129a0a15cab482c Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 3 Feb 2024 10:25:16 +0100 Subject: [PATCH] fix: use neutral or username color for reply messages (#5145) --- CHANGELOG.md | 1 + src/messages/Message.hpp | 2 ++ src/messages/SharedMessageBuilder.cpp | 1 + src/providers/twitch/TwitchMessageBuilder.cpp | 7 ++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0fefbc01..05634cf7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ - Bugfix: Fixed popup windows not persisting between restarts. (#5081) - Bugfix: Fixed splits not retaining their focus after minimizing. (#5080) - Bugfix: Fixed _Copy message_ copying the channel name in global search. (#5106) +- Bugfix: Reply contexts now use the color of the replied-to message. (#5145) - Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978) - Dev: Change clang-format from v14 to v16. (#4929) - Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791) diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 82de23fe6..937309cf7 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -57,6 +57,8 @@ enum class MessageFlag : int64_t { RestrictedMessage = (1LL << 33), /// The message is sent by a user marked as monitor with Twitch's "Low Trust"/"Suspicious User" feature MonitoredMessage = (1LL << 34), + /// The message is an ACTION message (/me) + Action = (1LL << 35), }; using MessageFlags = FlagsEnum; diff --git a/src/messages/SharedMessageBuilder.cpp b/src/messages/SharedMessageBuilder.cpp index 850df978b..78d8c0a69 100644 --- a/src/messages/SharedMessageBuilder.cpp +++ b/src/messages/SharedMessageBuilder.cpp @@ -77,6 +77,7 @@ void SharedMessageBuilder::parse() if (this->action_) { this->textColor_ = this->usernameColor_; + this->message().flags.set(MessageFlag::Action); } this->parseUsername(); diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 4d99241a8..5037da561 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -896,11 +896,16 @@ void TwitchMessageBuilder::parseThread() threadRoot->usernameColor, FontStyle::ChatMediumSmall) ->setLink({Link::UserInfo, threadRoot->displayName}); + MessageColor color = MessageColor::Text; + if (threadRoot->flags.has(MessageFlag::Action)) + { + color = threadRoot->usernameColor; + } this->emplace( threadRoot->messageText, MessageElementFlags({MessageElementFlag::RepliedMessage, MessageElementFlag::Text}), - this->textColor_, FontStyle::ChatMediumSmall) + color, FontStyle::ChatMediumSmall) ->setLink({Link::ViewThread, this->thread_->rootId()}); } else if (this->tags.find("reply-parent-msg-id") != this->tags.end())