- inline IgnoreListManager(QObject *parent = 0) : SyncableObject(parent) { setAllowClientUpdates(true); }
- IgnoreListManager &operator=(const IgnoreListManager &other);
-
- enum IgnoreType {
- SenderIgnore,
- MessageIgnore
- };
-
- enum StrictnessType {
- UnmatchedStrictness = 0,
- SoftStrictness = 1,
- HardStrictness = 2
- };
-
- enum ScopeType {
- GlobalScope,
- NetworkScope,
- ChannelScope,
- };
-
- struct IgnoreListItem {
- IgnoreType type;
- QString ignoreRule;
- bool isRegEx;
- StrictnessType strictness;
- ScopeType scope;
- QString scopeRule;
- bool isActive;
- 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_) {}
- bool operator!=(const IgnoreListItem &other) {
- return (type != other.type ||
- ignoreRule != other.ignoreRule ||
- isRegEx != other.isRegEx ||
- strictness != other.strictness ||
- scope != other.scope ||
- scopeRule != other.scopeRule ||
- isActive != other.isActive);
- }
- };
- typedef QList<IgnoreListItem> IgnoreList;
-
- int indexOf(const QString &ignore) const;
- inline bool contains(const QString &ignore) const { return indexOf(ignore) != -1; }
- inline bool isEmpty() const { return _ignoreList.isEmpty(); }
- inline int count() const { return _ignoreList.count(); }
- inline void removeAt(int index) { _ignoreList.removeAt(index); }
- inline IgnoreListItem &operator[](int i) { return _ignoreList[i]; }
- inline const IgnoreListItem &operator[](int i) const { return _ignoreList.at(i); }
- inline const IgnoreList &ignoreList() const { return _ignoreList; }
-
- //! Check if a message matches the IgnoreRule
- /** This method checks if a message matches the users ignorelist.
- * \param msg The Message that should be checked
- * \param network The networkname the message belongs to
- * \return UnmatchedStrictness, HardStrictness or SoftStrictness representing the match type
- */
- StrictnessType match(const Message &msg, const QString &network = QString());
+ inline IgnoreListManager(QObject *parent = 0) : SyncableObject(parent) { setAllowClientUpdates(true); }
+ IgnoreListManager &operator=(const IgnoreListManager &other);
+
+ enum IgnoreType {
+ SenderIgnore,
+ MessageIgnore,
+ CtcpIgnore
+ };
+
+ enum StrictnessType {
+ UnmatchedStrictness = 0,
+ SoftStrictness = 1,
+ HardStrictness = 2
+ };
+
+ enum ScopeType {
+ GlobalScope,
+ NetworkScope,
+ ChannelScope,
+ };
+
+ struct IgnoreListItem {
+ IgnoreType type;
+ QString ignoreRule;
+ bool isRegEx;
+ StrictnessType strictness;
+ 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_), regEx(ignoreRule_) {
+ regEx.setCaseSensitivity(Qt::CaseInsensitive);
+ if (!isRegEx_) {
+ regEx.setPatternSyntax(QRegExp::Wildcard);
+ }
+ }
+ bool operator!=(const IgnoreListItem &other)
+ {
+ return (type != other.type ||
+ ignoreRule != other.ignoreRule ||
+ isRegEx != other.isRegEx ||
+ strictness != other.strictness ||
+ scope != other.scope ||
+ scopeRule != other.scopeRule ||
+ isActive != other.isActive);
+ }
+ };
+ typedef QList<IgnoreListItem> IgnoreList;
+
+ int indexOf(const QString &ignore) const;
+ inline bool contains(const QString &ignore) const { return indexOf(ignore) != -1; }
+ inline bool isEmpty() const { return _ignoreList.isEmpty(); }
+ inline int count() const { return _ignoreList.count(); }
+ inline void removeAt(int index) { _ignoreList.removeAt(index); }
+ inline IgnoreListItem &operator[](int i) { return _ignoreList[i]; }
+ inline const IgnoreListItem &operator[](int i) const { return _ignoreList.at(i); }
+ inline const IgnoreList &ignoreList() const { return _ignoreList; }
+
+ //! Check if a message matches the IgnoreRule
+ /** This method checks if a message matches the users ignorelist.
+ * \param msg The Message that should be checked
+ * \param network The networkname the message belongs to
+ * \return UnmatchedStrictness, HardStrictness or SoftStrictness representing the match type
+ */
+ inline StrictnessType match(const Message &msg, const QString &network = QString()) { return _match(msg.contents(), msg.sender(), msg.type(), network, msg.bufferInfo().bufferName()); }
+
+ bool ctcpMatch(const QString sender, const QString &network, const QString &type = QString());
+
+// virtual void addIgnoreListItem(const IgnoreListItem &item);