X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fignorelistmanager.h;h=171f8b23522fec7ffc4e1d8cbfdb1a38709a004e;hp=a906b953d0667b36db5c2a73a4cb85078ed5a0d0;hb=580662426b8b734566b37de61deccf5b89970c6e;hpb=27302bba72a29977e81b9a0b2d8cde3a62ebc818 diff --git a/src/common/ignorelistmanager.h b/src/common/ignorelistmanager.h index a906b953..171f8b23 100644 --- a/src/common/ignorelistmanager.h +++ b/src/common/ignorelistmanager.h @@ -29,6 +29,7 @@ class Message; class IgnoreListManager : public SyncableObject { + SYNCABLE_OBJECT Q_OBJECT public: inline IgnoreListManager(QObject *parent = 0) : SyncableObject(parent) { setAllowClientUpdates(true); } @@ -36,7 +37,8 @@ public: enum IgnoreType { SenderIgnore, - MessageIgnore + MessageIgnore, + CtcpIgnore }; enum StrictnessType { @@ -92,22 +94,56 @@ public: */ StrictnessType match(const Message &msg, const QString &network = QString()); + bool ctcpMatch(const QString sender, const QString &network, const QString &type = QString()); + +// virtual void addIgnoreListItem(const IgnoreListItem &item); + public slots: virtual QVariantMap initIgnoreList() const; virtual void initSetIgnoreList(const QVariantMap &ignoreList); - virtual void addIgnoreListItem(IgnoreType type, const QString &ignoreRule, bool isRegEx, StrictnessType strictness, - ScopeType scope, const QString &scopeRule, bool isActive); - virtual void addIgnoreListItem(const IgnoreListItem &item); + //! Request removal of an ignore rule based on the rule itself. + /** Use this method if you want to remove a single ignore rule + * and get that synced with the core immediately. + * \param ignoreRule A valid ignore rule + */ + virtual inline void requestRemoveIgnoreListItem(const QString &ignoreRule) { REQUEST(ARG(ignoreRule)) } + virtual void removeIgnoreListItem(const QString &ignoreRule); + + //! Request toggling of "isActive" flag of a given ignore rule. + /** Use this method if you want to toggle the "isActive" flag of a single ignore rule + * and get that synced with the core immediately. + * \param ignoreRule A valid ignore rule + */ + virtual inline void requestToggleIgnoreRule(const QString &ignoreRule) { REQUEST(ARG(ignoreRule)) } + virtual void toggleIgnoreRule(const QString &ignoreRule); + + //! Request an IgnoreListItem to be added to the ignore list + /** Items added to the list with this method, get immediately synced with the core + * \param type The IgnoreType of the new rule + * \param ignoreRule The rule itself + * \param isRegEx Signals if the rule should be interpreted as a regular expression + * \param strictness Th StrictnessType that should be applied + * \param scope The ScopeType that should be set + * \param scopeRule A string of semi-colon separated network- or channelnames + * \param isActive Signals if the rule is enabled or not + */ + virtual inline void requestAddIgnoreListItem(int type, const QString &ignoreRule, bool isRegEx, int strictness, + int scope, const QString &scopeRule, bool isActive) { + REQUEST(ARG(type), ARG(ignoreRule), ARG(isRegEx), ARG(strictness), ARG(scope), ARG(scopeRule), ARG(isActive)) + } + virtual void addIgnoreListItem(int type, const QString &ignoreRule, bool isRegEx, int strictness, + int scope, const QString &scopeRule, bool isActive); + protected: void setIgnoreList(const QList &ignoreList) { _ignoreList = ignoreList; } + // scopeRule is a ; separated list, string is a network/channel-name + bool scopeMatch(const QString &scopeRule, const QString &string) const; signals: void ignoreAdded(IgnoreType type, const QString &ignoreRule, bool isRegex, StrictnessType strictness, ScopeType scope, const QVariant &scopeRule, bool isActive); private: - // scopeRule is a ; separated list, string is a network/channel-name - bool scopeMatch(const QString &scopeRule, const QString &string); IgnoreList _ignoreList; };