+ /**
+ * Sets the scope rule this rule matches
+ *
+ * @param scopeRule String representing a phrase or expression to match
+ */
+ inline void setScopeRule(const QString &scopeRule) {
+ _scopeRule = scopeRule;
+ _cacheInvalid = true;
+ }
+
+ /**
+ * Gets if this rule is enabled and active
+ *
+ * @return True if enabled, otherwise false
+ */
+ inline bool isEnabled() const {
+ return _isEnabled;
+ }
+ /**
+ * Sets if this rule is enabled and active
+ *
+ * @param isEnabled True if enabled, otherwise false
+ */
+ inline void setIsEnabled(bool isEnabled) {
+ _isEnabled = isEnabled;
+ }
+
+ /**
+ * Gets the ignored CTCP types for CTCP ignores
+ *
+ * @return List of CTCP types to ignore, or empty for all
+ */
+ inline QStringList ctcpTypes() const {
+ return _cacheCtcpTypes;
+ }
+
+ /**
+ * Gets the expression matcher for the message contents, caching if needed
+ *
+ * @return Expression matcher to compare with message contents
+ */
+ inline ExpressionMatch contentsMatcher() const {
+ if (_cacheInvalid) {
+ determineExpressions();
+ }
+ return _contentsMatch;
+ }
+
+ /**
+ * Gets the expression matcher for the scope, caching if needed
+ *
+ * @return Expression matcher to compare with scope
+ */
+ inline ExpressionMatch scopeRuleMatcher() const {
+ if (_cacheInvalid) {
+ determineExpressions();
+ }
+ return _scopeRuleMatch;
+ }
+
+ /**
+ * Gets the expression matcher for the message contents, caching if needed
+ *
+ * @return Expression matcher to compare with message contents
+ */
+ inline ExpressionMatch senderCTCPMatcher() const {
+ if (_cacheInvalid) {
+ determineExpressions();
+ }
+ return _ctcpSenderMatch;
+ }
+
+ bool operator!=(const IgnoreListItem &other) const;
+
+ private:
+ /**
+ * Update internal cache of expression matching if needed
+ */
+ void determineExpressions() const;
+
+ IgnoreType _type = {};
+ QString _contents = {};
+ bool _isRegEx = false;
+ StrictnessType _strictness = {};
+ ScopeType _scope = {};
+ QString _scopeRule = {};
+ bool _isEnabled = true;
+
+ QString _cacheCtcpSender = {}; ///< For CTCP rules, precalculate sender
+ QStringList _cacheCtcpTypes = {}; ///< For CTCP rules, precalculate types
+
+ // These represent internal cache and should be safe to mutate in 'const' functions
+ // See https://stackoverflow.com/questions/3141087/what-is-meant-with-const-at-end-of-function-declaration
+ mutable bool _cacheInvalid = true; ///< If true, match cache needs redone
+ mutable ExpressionMatch _contentsMatch = {}; ///< Expression match cache for message
+ mutable ExpressionMatch _scopeRuleMatch = {}; ///< Expression match cache for scope rule
+ mutable ExpressionMatch _ctcpSenderMatch = {}; ///< Expression match cache for CTCP nick