X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fqtuimessageprocessor.cpp;h=aa24f08cbaafb2217a0763b3a7cce7be906706ad;hb=dd8d82a90c136fa1e56d7f72781881cd5099574f;hp=e245a7bcd279069898526acba72e2dac2ca0c2ff;hpb=e036ee9df2219667ce1cc22d42a7c50fbdf5b3ba;p=quassel.git diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index e245a7bc..aa24f08c 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["Chan"].toString()); iter++; } }