+
+
+/**************************************************************************
+ * IgnoreListItem
+ *************************************************************************/
+bool IgnoreListManager::IgnoreListItem::operator!=(const IgnoreListItem &other) const
+{
+ return (_type != other._type ||
+ _contents != other._contents ||
+ _isRegEx != other._isRegEx ||
+ _strictness != other._strictness ||
+ _scope != other._scope ||
+ _scopeRule != other._scopeRule ||
+ _isEnabled != other._isEnabled);
+ // Don't compare ExpressionMatch objects as they are created as needed from the above
+}
+
+
+void IgnoreListManager::IgnoreListItem::determineExpressions() const
+{
+ // Don't update if not needed
+ if (!_cacheInvalid) {
+ return;
+ }
+
+ // Set up matching rules
+ // Message is either wildcard or regex
+ ExpressionMatch::MatchMode contentsMode =
+ _isRegEx ? ExpressionMatch::MatchMode::MatchRegEx :
+ ExpressionMatch::MatchMode::MatchWildcard;
+
+ // Ignore rules are always case-insensitive
+ // Scope matching is always wildcard
+ // TODO: Expand upon ignore rule handling with next protocol break
+
+ if (_type == CtcpIgnore) {
+ // Set up CTCP sender
+ _contentsMatch = {};
+ _ctcpSenderMatch = ExpressionMatch(_cacheCtcpSender, contentsMode, false);
+ }
+ else {
+ // Set up message contents
+ _contentsMatch = ExpressionMatch(_contents, contentsMode, false);
+ _ctcpSenderMatch = {};
+ }
+ // Scope rules are always multiple wildcard entries
+ // (Adding a regex option would be awesome, but requires a backwards-compatible protocol change)
+ _scopeRuleMatch = ExpressionMatch(_scopeRule,
+ ExpressionMatch::MatchMode::MatchMultiWildcard, false);
+
+ _cacheInvalid = false;
+}