qtui: Set proper icon for "About Quassel" menu option
[quassel.git] / src / common / ignorelistmanager.h
index fabded7..d5a1c8a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2012 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  *
 #define IGNORELISTMANAGER_H
 
 #include <QString>
+#include <QRegExp>
 
 #include "message.h"
 #include "syncableobject.h"
+// Scope matching
+#include "util.h"
 
 class IgnoreListManager : public SyncableObject
 {
@@ -60,10 +63,16 @@ public:
         ScopeType scope;
         QString scopeRule;
         bool isActive;
+        QRegExp regEx;
         IgnoreListItem() {}
         IgnoreListItem(IgnoreType type_, const QString &ignoreRule_, bool isRegEx_, StrictnessType strictness_,
             ScopeType scope_, const QString &scopeRule_, bool isActive_)
-            : type(type_), ignoreRule(ignoreRule_), isRegEx(isRegEx_), strictness(strictness_), scope(scope_), scopeRule(scopeRule_), isActive(isActive_)  {}
+            : type(type_), ignoreRule(ignoreRule_), isRegEx(isRegEx_), strictness(strictness_), scope(scope_), scopeRule(scopeRule_), isActive(isActive_), regEx(ignoreRule_) {
+            regEx.setCaseSensitivity(Qt::CaseInsensitive);
+            if (!isRegEx_) {
+                regEx.setPatternSyntax(QRegExp::Wildcard);
+            }
+        }
         bool operator!=(const IgnoreListItem &other)
         {
             return (type != other.type ||
@@ -140,7 +149,6 @@ public slots:
 
 protected:
     void setIgnoreList(const QList<IgnoreListItem> &ignoreList) { _ignoreList = ignoreList; }
-    bool scopeMatch(const QString &scopeRule, const QString &string) const; // scopeRule is a ';'-separated list, string is a network/channel-name
 
     StrictnessType _match(const QString &msgContents, const QString &msgSender, Message::Type msgType, const QString &network, const QString &bufferName);