From e3a91437981155e3657284cbd850c22c6522817b Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Fri, 2 Dec 2016 18:43:15 -0600 Subject: [PATCH] Use new nick for finding hash of Nick messages For nick change messages, use the new nickname for calculating the sender hash, not the old one. This more closely matches expectations. Works around a limitation in the Quassel theming engine that doesn't allow different styling for multiple nicks in one message. Unfortunately, rewriting the necessary parts of the theme engine to support multiple styles per nick is above my understanding right now. --- src/uisupport/uistyle.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 6c6e999d..f35543de 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -961,7 +961,19 @@ quint8 UiStyle::StyledMessage::senderHash() const if (_senderHash != 0xff) return _senderHash; - QString nick = nickFromMask(sender()).toLower(); + QString nick; + + // HACK: Until multiple nicknames with different colors can be solved in the theming engine, + // for /nick change notifications, use the color of the new nickname (if possible), not the old + // nickname. + if (type() == Message::Nick) { + // New nickname is given as contents. Change to that. + nick = stripFormatCodes(contents()).toLower(); + } else { + // Just use the sender directly + nick = nickFromMask(sender()).toLower(); + } + if (!nick.isEmpty()) { int chopCount = 0; while (chopCount < nick.size() && nick.at(nick.count() - 1 - chopCount) == '_') -- 2.20.1