common: Add inverted scope match rules to ignores
[quassel.git] / src / common / ignorelistmanager.h
index a2d3368..ef86d5e 100644 (file)
@@ -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  *
@@ -147,7 +147,19 @@ 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
+
+    //! Check if a scope rule matches a string
+    /** Checks that the string does NOT match ANY inverted rules (prefixed by '!'), then checks that
+     * it matches AT LEAST one normal (non-inverted) rule.
+     *
+     * If only inverted rules are specified, it'll match so long as the string does not match any
+     * inverted rules (implicit wildcard).
+     *
+     * \param scopeRule  A ';'-separated list of wildcard expressions, prefix of '!' inverts subrule
+     * \param string     String to test, e.g. network/channel name
+     * \return True if matches, otherwise false
+     */
+    bool scopeMatch(const QString &scopeRule, const QString &string) const;
 
     StrictnessType _match(const QString &msgContents, const QString &msgSender, Message::Type msgType, const QString &network, const QString &bufferName);