X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=f35543de50a66e3bfa5869544ee61a8334965909;hb=7fccb74ec00f505d3a5485ad9592c37248c1e8c6;hp=fd2bee5283a67ab63ff1f5493bc0bdb5158c0f6d;hpb=27fe4e6f46547c45d19fa39c175fa2104a5feb28;p=quassel.git diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index fd2bee52..f35543de 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -735,11 +735,28 @@ QString UiStyle::timestampFormatString() UiStyle::StyledMessage::StyledMessage(const Message &msg) : Message(msg) { - if (type() == Message::Plain || type() == Message::Action) - _senderHash = 0xff; - else - _senderHash = 0x00; - // This means we never compute the hash for msgs that aren't Plain or Action + switch (type()) { + // Don't compute the sender hash for message types without a nickname embedded + case Message::Server: + case Message::Info: + case Message::Error: + case Message::DayChange: + case Message::Topic: + case Message::Invite: + // Don't compute the sender hash for messages with multiple nicks + // Fixing this without breaking themes would be.. complex. + case Message::NetsplitJoin: + case Message::NetsplitQuit: + case Message::Kick: + // Don't compute the sender hash for message types that are not yet completed elsewhere + case Message::Kill: + _senderHash = 0x00; + break; + default: + // Compute the sender hash for all other message types + _senderHash = 0xff; + break; + } } @@ -944,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) == '_')