From: Shane Synan Date: Thu, 13 Sep 2018 06:34:44 +0000 (-0500) Subject: core: Cancel nickname AutoWho on IrcUser quit X-Git-Tag: 0.13-rc2~28 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b33ea3ad0598e43621f3923e0fbc01e87b9b0031 core: Cancel nickname AutoWho on IrcUser quit Remove any queued AutoWho for if quits. This avoids sending a needless AutoWho for that'll only either result in "No such nickname" if we're lucky, or random results for non-extended WHO if happens to match the realname/etc of other IRC users. This should fix any remaining cases of join/quit resulting in AutoWho output in the Status Buffer for a network. --- diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index fcafde47..395cb7a3 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -1322,6 +1322,16 @@ void CoreNetwork::queueAutoWhoOneshot(const QString &channelOrNick) } +void CoreNetwork::cancelAutoWhoOneshot(const QString &channelOrNick) +{ + // Remove channel/nick from queue if it exists + _autoWhoQueue.removeAll(channelOrNick); + + // The AutoWho timer will detect if the queue is empty and automatically stop, no need to + // manually control it. +} + + void CoreNetwork::setAutoWhoDelay(int delay) { _autoWhoTimer.setInterval(delay * 1000); diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h index f2f7c4d7..86fc4ab9 100644 --- a/src/core/corenetwork.h +++ b/src/core/corenetwork.h @@ -392,6 +392,18 @@ public slots: */ void queueAutoWhoOneshot(const QString &channelOrNick); + /** + * Removes the given channel/nick from AutoWho queue for when it stops existing + * + * If not already in queue, nothing happens. This should only be used for nicknames and + * channels that have suddenly stopped existing (e.g. nick joins then quits). + * + * For when a periodic channel AutoWho finishes, see CoreNetwork::setAutoWhoDone() + * + * @param channelOrNick Channel or nickname to WHO + */ + void cancelAutoWhoOneshot(const QString &channelOrNick); + bool setAutoWhoDone(const QString &channel); void updateIssuedModes(const QString &requestedModes); diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index a461491c..defee988 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -753,6 +753,10 @@ void CoreSessionEventProcessor::lateProcessIrcEventQuit(IrcEvent *e) if (!ircuser) return; + // Clear the user from the AutoWho queue if in it + // This avoids needlessly checking a user that quickly joins then parts + coreNetwork(e)->cancelAutoWhoOneshot(ircuser->nick()); + ircuser->quit(); }