X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtuimessageprocessor.cpp;h=0e0dca58d6e528f9d6b1ccfb3856463468f0a863;hp=68690f84a3385db0d7a30d9f44258a008f0b3730;hb=e1dc333ae055788dd1a2da86ca72aa126c157697;hpb=e50ae7a06fc4e5d3a911c361d30953410deab609 diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index 68690f84..0e0dca58 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -70,7 +70,7 @@ void QtUiMessageProcessor::process(QList &msgs) while (msgIter != msgIterEnd) { checkForHighlight(*msgIter); preProcess(*msgIter); - msgIter++; + ++msgIter; } Client::messageModel()->insertMessages(msgs); return; @@ -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; } @@ -141,17 +141,12 @@ void QtUiMessageProcessor::checkForHighlight(Message &msg) if (!rule.isEnabled) 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; - } + if (!rule.chanName.isEmpty() + && !scopeMatch(msg.bufferInfo().bufferName(), rule.chanName, + rule.isRegExp, rule.caseSensitive)) { + // A channel name rule is specified and does NOT match the current buffer name, skip + // this rule + continue; } QRegExp rx; @@ -161,7 +156,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; @@ -190,7 +185,7 @@ void QtUiMessageProcessor::highlightListChanged(const QVariant &variant) rule["CS"].toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive, rule["RegEx"].toBool(), rule["Channel"].toString()); - iter++; + ++iter; } }