X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fhighlightrulemanager.h;h=e754b8b90af7c82e2afd987ea985aa3721680ce6;hp=b606a0a8a7bf61d6fc4bb1caf664fa5196ec1d0e;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hpb=7678f2402fdb01b03b359a2266f1e7427894d82a diff --git a/src/common/highlightrulemanager.h b/src/common/highlightrulemanager.h index b606a0a8..e754b8b9 100644 --- a/src/common/highlightrulemanager.h +++ b/src/common/highlightrulemanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 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 * @@ -18,11 +18,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef HIGHLIGHTRULELISTMANAGER_H -#define HIGHLIGHTRULELISTMANAGER_H +#pragma once + +#include -#include #include +#include +#include +#include +#include #include "message.h" #include "syncableobject.h" @@ -47,12 +51,13 @@ public: bool isCaseSensitive = false; bool isEnabled = true; bool isInverse = false; + QString sender; QString chanName; HighlightRule() {} - HighlightRule(const QString &name_, bool isRegEx_, bool isCaseSensitive_, - bool isEnabled_, bool isInverse_, const QString &chanName_) - : name(name_), isRegEx(isRegEx_), isCaseSensitive(isCaseSensitive_), isEnabled(isEnabled_), - isInverse(isInverse_), 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) { @@ -61,6 +66,7 @@ public: isCaseSensitive != other.isCaseSensitive || isEnabled != other.isEnabled || isInverse != other.isInverse || + sender != other.sender || chanName != other.chanName); } }; @@ -77,7 +83,7 @@ public: inline const HighlightRuleList &highlightRuleList() const { return _highlightRuleList; } inline HighlightNickType highlightNick() { return _highlightNick; } - inline bool nicksCaseSensitive() { return _nicksCaseSensitive; } + inline bool nicksCaseSensitive() { return _nicksCaseSensitive; } //! Check if a message matches the HighlightRule /** This method checks if a message matches the users highlight rules. @@ -114,14 +120,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, - bool isInverse, const QString &chanName) + bool isInverse, const QString &sender, const QString &chanName) { - REQUEST(ARG(name), ARG(isRegEx), ARG(isCaseSensitive), ARG(isEnabled), ARG(isInverse), 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, bool isInverse, 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) { @@ -138,16 +144,19 @@ public slots: protected: void setHighlightRuleList(const QList &HighlightRuleList) { _highlightRuleList = HighlightRuleList; } - bool _match(const QString &msgContents, const QString &msgSender, Message::Type msgType, Message::Flags msgFlags, const QString &bufferName, const QString ¤tNick, const QStringList identityNicks); + 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, bool isInverse, QString chanName); + void ruleAdded(QString name, bool isRegEx, bool isCaseSensitive, bool isEnabled, bool isInverse, QString sender, QString chanName); private: HighlightRuleList _highlightRuleList; HighlightNickType _highlightNick = HighlightNickType::CurrentNick; bool _nicksCaseSensitive = false; }; - - -#endif // HIGHLIGHTRULELISTMANAGER_H