X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtuimessageprocessor.h;h=6a9684f7a64929c6805ea8d9aa700052095c173a;hp=d8559d362f8de405a0bf8d1ea8420bd1a684125c;hb=4c4fe2b514fc7ecf3186202d73b3b5ff8847763f;hpb=ee8b9f55860e340c1600188fddcfd557c7489f66 diff --git a/src/qtui/qtuimessageprocessor.h b/src/qtui/qtuimessageprocessor.h index d8559d36..6a9684f7 100644 --- a/src/qtui/qtuimessageprocessor.h +++ b/src/qtui/qtuimessageprocessor.h @@ -25,6 +25,7 @@ #include "abstractmessageprocessor.h" #include "expressionmatch.h" +#include "nickhighlightmatcher.h" class QtUiMessageProcessor : public AbstractMessageProcessor { @@ -47,6 +48,18 @@ public slots: void process(Message &msg); void process(QList &msgs); + /** + * Network removed from system + * + * Handles cleaning up cache from stale networks. + * + * @param id Network ID of removed network + */ + inline void networkRemoved(NetworkId id) { + // Clean up nickname matching cache + _nickMatcher.removeNetwork(id); + } + private slots: void processNextMessage(); void nicksCaseSensitiveChanged(const QVariant &variant); @@ -239,33 +252,12 @@ private: using HighlightNickType = NotificationSettings::HighlightNickType; - /** - * Update internal cache of expression matching if needed - */ - void determineNickExpressions(const QString ¤tNick, - const QStringList identityNicks) const; + LegacyHighlightRuleList _highlightRuleList; ///< Custom highlight rule list + NickHighlightMatcher _nickMatcher = {}; ///< Nickname highlight matcher - /** - * Check if nickname matching cache is invalid - * @param currentNick - * @param identityNicks - * @return - */ - bool cacheNickInvalid(const QString ¤tNick, const QStringList identityNicks) const { - if (_cacheNickConfigInvalid) return true; - if (_cachedNickCurrent != currentNick) return true; - if (_cachedIdentityNicks != identityNicks) return true; - } - - LegacyHighlightRuleList _highlightRuleList; + /// Nickname highlighting mode HighlightNickType _highlightNick = HighlightNickType::CurrentNick; - bool _nicksCaseSensitive = false; - - // These represent internal cache and should be safe to mutate in 'const' functions - mutable bool _cacheNickConfigInvalid = true; ///< If true, nick match cache needs redone - mutable QString _cachedNickCurrent = {}; ///< Last cached current nick - mutable QStringList _cachedIdentityNicks = {}; ///< Last cached identity nicks - mutable ExpressionMatch _cachedNickMatcher = {}; ///< Expression match cache for nicks + bool _nicksCaseSensitive = false; ///< If true, match nicknames with exact case QList > _processQueue; QList _currentBatch;