From 0011904b11f489e2989469f55af825cd2f1bdff2 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Tue, 1 Aug 2023 20:11:19 +0200 Subject: [PATCH 1/4] Split log line generation from message search text --- src/singletons/helper/LoggingChannel.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/singletons/helper/LoggingChannel.cpp b/src/singletons/helper/LoggingChannel.cpp index 9f10f87c39e..0d718fc9d3a 100644 --- a/src/singletons/helper/LoggingChannel.cpp +++ b/src/singletons/helper/LoggingChannel.cpp @@ -105,20 +105,32 @@ void LoggingChannel::addMessage(MessagePtr message) str.append(now.toString("HH:mm:ss")); str.append("] "); - QString messageSearchText = message->searchText; + QString messageText; + if (message->loginName.isEmpty()) + { + // This accounts for any messages not explicitly sent by a user, like + // system messages, parts of announcements, subs etc. + messageText = message->messageText; + } + else + { + messageText = message->localizedName + " " + message->loginName + ": " + + message->messageText; + } + if ((message->flags.has(MessageFlag::ReplyMessage) && getSettings()->stripReplyMention) && !getSettings()->hideReplyContext) { - qsizetype colonIndex = messageSearchText.indexOf(':'); + qsizetype colonIndex = messageText.indexOf(':'); if (colonIndex != -1) { QString rootMessageChatter = message->replyThread->root()->loginName; - messageSearchText.insert(colonIndex + 1, " @" + rootMessageChatter); + messageText.insert(colonIndex + 1, " @" + rootMessageChatter); } } - str.append(messageSearchText); + str.append(messageText); str.append(endline); this->appendLine(str); From ebc21602bcb61a432c76c8aa1e99af646326d915 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Tue, 1 Aug 2023 20:31:57 +0200 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f8c817dcf5..dee66ddc877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - Bugfix: Fixed highlights sometimes not working after changing sound device, or switching users in your operating system. (#4729) - Bugfix: Fixed key bindings not showing in context menus on Mac. (#4722) - Bugfix: Fixed tab completion rarely completing the wrong word. (#4735) +- Bugfix: Fixed duplicate username in logs (#4742) - Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637) - Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570) - Dev: Added test cases for emote and tab completion. (#4644) From 47f0611acfa6a4277b9ddb3b20287acce4837c4f Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 5 Aug 2023 13:50:34 +0200 Subject: [PATCH 3/4] remove empty space at the beginning of usernames --- src/singletons/helper/LoggingChannel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/singletons/helper/LoggingChannel.cpp b/src/singletons/helper/LoggingChannel.cpp index 0d718fc9d3a..b47aec19d4e 100644 --- a/src/singletons/helper/LoggingChannel.cpp +++ b/src/singletons/helper/LoggingChannel.cpp @@ -114,8 +114,15 @@ void LoggingChannel::addMessage(MessagePtr message) } else { - messageText = message->localizedName + " " + message->loginName + ": " + - message->messageText; + if (message->localizedName.isEmpty()) + { + messageText = message->loginName + ": " + message->messageText; + } + else + { + messageText = message->localizedName + " " + message->loginName + + ": " + message->messageText; + } } if ((message->flags.has(MessageFlag::ReplyMessage) && From 33b5f0d0235c0bbd0dac26c7441772ba7b6b7262 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 5 Aug 2023 13:51:03 +0200 Subject: [PATCH 4/4] Move changelog entry --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dee66ddc877..e3ea0301256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Minor: Message input is now focused when clicking on emotes. (#4719) - Minor: Changed viewer list to chatter list to more match Twitch's terminology. (#4732) -- Minor: Nicknames are now taken into consideration when searching for messages. (#4663) +- Minor: Nicknames are now taken into consideration when searching for messages. (#4663, #4742) - Minor: Add an icon showing when streamer mode is enabled (#4410, #4690) - Minor: Added `/shoutout ` commands to shoutout specified user. (#4638) - Minor: Improved editing hotkeys. (#4628) @@ -31,7 +31,6 @@ - Bugfix: Fixed highlights sometimes not working after changing sound device, or switching users in your operating system. (#4729) - Bugfix: Fixed key bindings not showing in context menus on Mac. (#4722) - Bugfix: Fixed tab completion rarely completing the wrong word. (#4735) -- Bugfix: Fixed duplicate username in logs (#4742) - Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637) - Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570) - Dev: Added test cases for emote and tab completion. (#4644)