Split log line generation from message search text (#4742)

* Split log line generation from message search text

* changelog

* remove empty space at the beginning of usernames

* Move changelog entry

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2023-08-05 15:09:56 +02:00 committed by GitHub
parent 5727db2029
commit e13df1f602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View file

@ -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 <username>` commands to shoutout specified user. (#4638)
- Minor: Improved editing hotkeys. (#4628)

View file

@ -105,20 +105,39 @@ 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
{
if (message->localizedName.isEmpty())
{
messageText = message->loginName + ": " + 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);