X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtuimessageprocessor.cpp;h=4754a024eac61f9b764cf05b3778321da3c0510e;hp=336a18d1063ca2cd7e338874ba4096f8b2517b38;hb=3202bf5340396b5c6b467e8d92d808b1cbbbf7fb;hpb=2a92a244f96e03c3c340564b0baf439e13b1818b diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index 336a18d1..4754a024 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -129,16 +129,27 @@ void QtUiMessageProcessor::checkForHighlight(Message &msg) { for(int i = 0; i < _highlightRules.count(); i++) { const HighlightRule &rule = _highlightRules.at(i); if(!rule.isEnabled) - continue; + continue; + + if(rule.chanName.size() > 0 && rule.chanName.compare(".*") != 0) { + if(rule.chanName.startsWith("!")) { + QRegExp rx(rule.chanName.mid(1), Qt::CaseInsensitive); + if(rx.exactMatch(msg.bufferInfo().bufferName())) + continue; + } else { + QRegExp rx(rule.chanName, Qt::CaseInsensitive); + if(!rx.exactMatch(msg.bufferInfo().bufferName())) + continue; + } + } - bool match = false; + QRegExp rx; if(rule.isRegExp) { - QRegExp rx(rule.name, rule.caseSensitive? Qt::CaseSensitive : Qt::CaseInsensitive); - match = rx.exactMatch(msg.contents()); + rx = QRegExp(rule.name, rule.caseSensitive? Qt::CaseSensitive : Qt::CaseInsensitive); } else { - QRegExp rx("(^|\\W)" + QRegExp::escape(rule.name) + "(\\W|$)", rule.caseSensitive? Qt::CaseSensitive : Qt::CaseInsensitive); - match = (rx.indexIn(msg.contents()) >= 0); + rx = QRegExp("(^|\\W)" + QRegExp::escape(rule.name) + "(\\W|$)", rule.caseSensitive? Qt::CaseSensitive : Qt::CaseInsensitive); } + bool match = (rx.indexIn(msg.contents()) >= 0); if(match) { msg.setFlags(msg.flags() | Message::Highlight); return; @@ -161,7 +172,8 @@ void QtUiMessageProcessor::highlightListChanged(const QVariant &variant) { _highlightRules << HighlightRule(rule["Name"].toString(), rule["Enable"].toBool(), rule["CS"].toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive, - rule["RegEx"].toBool()); + rule["RegEx"].toBool(), + rule["Channel"].toString()); iter++; } }