X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fhighlightrulemanager.h;h=427b65819a812f8bc6a59a53dcac4e5229d1ea82;hp=02b1a2234c37f4fccedd7924b725fd939b100387;hb=8fe8accd73abf77ab21d2d1c1346d2bc5c4de2ff;hpb=16f22647e6890d3eb8c3e94f7a0700e12fa29e44 diff --git a/src/common/highlightrulemanager.h b/src/common/highlightrulemanager.h index 02b1a223..427b6581 100644 --- a/src/common/highlightrulemanager.h +++ b/src/common/highlightrulemanager.h @@ -23,6 +23,7 @@ #include #include +#include #include "message.h" #include "syncableobject.h" @@ -46,11 +47,14 @@ public: bool isRegEx = false; bool isCaseSensitive = false; bool isEnabled = true; + bool isInverse = false; + QString sender; QString chanName; HighlightRule() {} - HighlightRule(const QString &name_, bool isRegEx_, bool isCaseSensitive_, - bool isEnabled_, const QString &chanName_) - : name(name_), isRegEx(isRegEx_), isCaseSensitive(isCaseSensitive_), isEnabled(isEnabled_), chanName(chanName_) { + HighlightRule(QString name_, bool isRegEx_, bool isCaseSensitive_, bool isEnabled_, bool isInverse_, + QString sender_, QString chanName_) + : name(std::move(name_)), isRegEx(isRegEx_), isCaseSensitive(isCaseSensitive_), isEnabled(isEnabled_), + isInverse(isInverse_), sender(std::move(sender_)), chanName(std::move(chanName_)) { } bool operator!=(const HighlightRule &other) { @@ -58,6 +62,8 @@ public: isRegEx != other.isRegEx || isCaseSensitive != other.isCaseSensitive || isEnabled != other.isEnabled || + isInverse != other.isInverse || + sender != other.sender || chanName != other.chanName); } }; @@ -68,15 +74,19 @@ public: inline bool isEmpty() const { return _highlightRuleList.isEmpty(); } inline int count() const { return _highlightRuleList.count(); } inline void removeAt(int index) { _highlightRuleList.removeAt(index); } + inline void clear() { _highlightRuleList.clear(); } inline HighlightRule &operator[](int i) { return _highlightRuleList[i]; } inline const HighlightRule &operator[](int i) const { return _highlightRuleList.at(i); } inline const HighlightRuleList &highlightRuleList() const { return _highlightRuleList; } + inline HighlightNickType highlightNick() { return _highlightNick; } + inline bool nicksCaseSensitive() { return _nicksCaseSensitive; } + //! Check if a message matches the HighlightRule /** This method checks if a message matches the users highlight rules. * \param msg The Message that should be checked */ - inline bool match(const Message &msg, const QString ¤tNick, const QStringList &identityNicks) { return _match(msg.contents(), msg.sender(), msg.type(), msg.flags(), msg.bufferInfo().bufferName(), currentNick, identityNicks); } + bool match(const Message &msg, const QString ¤tNick, const QStringList &identityNicks); public slots: virtual QVariantMap initHighlightRuleList() const; @@ -107,14 +117,14 @@ public slots: * @param chanName The channel in which the rule should apply */ virtual inline void requestAddHighlightRule(const QString &name, bool isRegEx, bool isCaseSensitive, bool isEnabled, - const QString &chanName) + bool isInverse, const QString &sender, const QString &chanName) { - REQUEST(ARG(name), ARG(isRegEx), ARG(isCaseSensitive), ARG(isEnabled), ARG(chanName)) + REQUEST(ARG(name), ARG(isRegEx), ARG(isCaseSensitive), ARG(isEnabled), ARG(isInverse), ARG(sender), ARG(chanName)) } - virtual void addHighlightRule(const QString &name, bool isRegEx, bool isCaseSensitive, - bool isEnabled, const QString &chanName); + virtual void addHighlightRule(const QString &name, bool isRegEx, bool isCaseSensitive, bool isEnabled, + bool isInverse, const QString &sender, const QString &chanName); virtual inline void requestSetHighlightNick(HighlightNickType highlightNick) { @@ -134,7 +144,7 @@ protected: bool _match(const QString &msgContents, const QString &msgSender, Message::Type msgType, Message::Flags msgFlags, const QString &bufferName, const QString ¤tNick, const QStringList identityNicks); signals: - void ruleAdded(QString name, bool isRegEx, bool isCaseSensitive, bool isEnabled, QString chanName); + void ruleAdded(QString name, bool isRegEx, bool isCaseSensitive, bool isEnabled, bool isInverse, QString sender, QString chanName); private: HighlightRuleList _highlightRuleList;