From: Shane Synan Date: Fri, 10 Jun 2016 21:14:21 +0000 (-0400) Subject: Strip format codes when checking for highlights X-Git-Tag: travis-deploy-test~451 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=f34bb7b60263683e8527b7b19cc5d1590390c4b1 Strip format codes when checking for highlights Strip format codes from message content when checking for highlights. This fixes color-coded messages not triggering highlights, e.g. messages from the qAnnounce bot in #quassel. Closes GH-211. --- diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index 87df2fda..eee90aab 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -130,7 +130,7 @@ void QtUiMessageProcessor::checkForHighlight(Message &msg) } foreach(QString nickname, nickList) { QRegExp nickRegExp("(^|\\W)" + QRegExp::escape(nickname) + "(\\W|$)", _nicksCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); - if (nickRegExp.indexIn(msg.contents()) >= 0) { + if (nickRegExp.indexIn(stripFormatCodes(msg.contents())) >= 0) { msg.setFlags(msg.flags() | Message::Highlight); return; } @@ -161,7 +161,7 @@ void QtUiMessageProcessor::checkForHighlight(Message &msg) else { rx = QRegExp("(^|\\W)" + QRegExp::escape(rule.name) + "(\\W|$)", rule.caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); } - bool match = (rx.indexIn(msg.contents()) >= 0); + bool match = (rx.indexIn(stripFormatCodes(msg.contents())) >= 0); if (match) { msg.setFlags(msg.flags() | Message::Highlight); return;