-IgnoreListManager::StrictnessType IgnoreListManager::_match(const QString &msgContents, const QString &msgSender, Message::Type msgType, const QString &network, const QString &bufferName) {
- // We method don't rely on a proper Message object to make this method more versatile.
- // This allows us to use it in the core with unprocessed Messages or in the Client
- // with properly preprocessed Messages.
- if(!(msgType & (Message::Plain | Message::Notice | Message::Action)))
+IgnoreListManager::StrictnessType IgnoreListManager::_match(
+ const QString& msgContents, const QString& msgSender, Message::Type msgType, const QString& network, const QString& bufferName)
+{
+ // We method don't rely on a proper Message object to make this method more versatile.
+ // This allows us to use it in the core with unprocessed Messages or in the Client
+ // with properly preprocessed Messages.
+ if (!(msgType & (Message::Plain | Message::Notice | Message::Action)))
+ return UnmatchedStrictness;
+
+ foreach (IgnoreListItem item, _ignoreList) {
+ if (!item.isEnabled() || item.type() == CtcpIgnore)
+ continue;
+ if (item.scope() == GlobalScope || (item.scope() == NetworkScope && item.scopeRuleMatcher().match(network))
+ || (item.scope() == ChannelScope && item.scopeRuleMatcher().match(bufferName))) {
+ QString str;
+ if (item.type() == MessageIgnore) {
+ // TODO: Make this configurable? Pre-0.14, format codes were not removed
+ str = stripFormatCodes(msgContents);
+ } else {
+ str = msgSender;
+ }
+
+ // qDebug() << "IgnoreListManager::match: ";
+ // qDebug() << "string: " << str;
+ // qDebug() << "pattern: " << ruleRx.pattern();
+ // qDebug() << "scopeRule: " << item.scopeRule;
+ // qDebug() << "now testing";
+ if (item.contentsMatcher().match(str)) {
+ return item.strictness();
+ }
+ }
+ }