From: Shane Synan Date: Fri, 14 Sep 2018 18:51:40 +0000 (-0500) Subject: core: Clean up AutoWho comments, variable names X-Git-Tag: 0.13-rc2~27 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=2d6adaf54681e31b6811decc585069233e8854ef core: Clean up AutoWho comments, variable names Clean up AutoWho variable names using the "name" convention from RFC 1459. Clean up AutoWho comments likewise, referring to "name" instead of "channel" where appropriate. See https://tools.ietf.org/html/rfc1459#section-4.5.1 --- diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 395cb7a3..2b739690 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -494,13 +494,13 @@ bool CoreNetwork::cipherUsesCBC(const QString &target) } #endif /* HAVE_QCA2 */ -bool CoreNetwork::setAutoWhoDone(const QString &channel) +bool CoreNetwork::setAutoWhoDone(const QString &name) { - QString chan = channel.toLower(); - if (_autoWhoPending.value(chan, 0) <= 0) + QString chanOrNick = name.toLower(); + if (_autoWhoPending.value(chanOrNick, 0) <= 0) return false; - if (--_autoWhoPending[chan] <= 0) - _autoWhoPending.remove(chan); + if (--_autoWhoPending[chanOrNick] <= 0) + _autoWhoPending.remove(chanOrNick); return true; } @@ -1308,12 +1308,12 @@ void CoreNetwork::startAutoWhoCycle() _autoWhoQueue = channels(); } -void CoreNetwork::queueAutoWhoOneshot(const QString &channelOrNick) +void CoreNetwork::queueAutoWhoOneshot(const QString &name) { // Prepend so these new channels/nicks are the first to be checked // Don't allow duplicates - if (!_autoWhoQueue.contains(channelOrNick.toLower())) { - _autoWhoQueue.prepend(channelOrNick.toLower()); + if (!_autoWhoQueue.contains(name.toLower())) { + _autoWhoQueue.prepend(name.toLower()); } if (capEnabled(IrcCap::AWAY_NOTIFY)) { // When away-notify is active, the timer's stopped. Start a new cycle to who this channel. @@ -1322,10 +1322,10 @@ void CoreNetwork::queueAutoWhoOneshot(const QString &channelOrNick) } -void CoreNetwork::cancelAutoWhoOneshot(const QString &channelOrNick) +void CoreNetwork::cancelAutoWhoOneshot(const QString &name) { // Remove channel/nick from queue if it exists - _autoWhoQueue.removeAll(channelOrNick); + _autoWhoQueue.removeAll(name); // The AutoWho timer will detect if the queue is empty and automatically stop, no need to // manually control it. diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h index 86fc4ab9..740430c5 100644 --- a/src/core/corenetwork.h +++ b/src/core/corenetwork.h @@ -90,7 +90,16 @@ public: inline QByteArray readChannelCipherKey(const QString &channel) const { return _cipherKeys.value(channel.toLower()); } inline void storeChannelCipherKey(const QString &channel, const QByteArray &key) { _cipherKeys[channel.toLower()] = key; } - inline bool isAutoWhoInProgress(const QString &channel) const { return _autoWhoPending.value(channel.toLower(), 0); } + /** + * Checks if the given target has an automatic WHO in progress + * + * @param name Channel or nickname + * @return True if an automatic WHO is in progress, otherwise false + */ + inline bool isAutoWhoInProgress(const QString &name) const + { + return _autoWhoPending.value(name.toLower(), 0); + } inline UserId userId() const { return _coreSession->user(); } @@ -388,23 +397,29 @@ public slots: * When 'away-notify' is enabled, this will trigger an immediate AutoWho since regular * who-cycles are disabled as per IRCv3 specifications. * - * @param[in] channelOrNick Channel or nickname to WHO + * @param[in] name Channel or nickname */ - void queueAutoWhoOneshot(const QString &channelOrNick); + void queueAutoWhoOneshot(const QString &name); /** - * Removes the given channel/nick from AutoWho queue for when it stops existing + * Removes the given channel/nick from AutoWho queue * - * 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). + * This can avoid needlessly WHO'ng nicknames and channels that are no longer of interest, e.g. + * if parting a channel right after joining or if a nick joins then quits. * * For when a periodic channel AutoWho finishes, see CoreNetwork::setAutoWhoDone() * - * @param channelOrNick Channel or nickname to WHO + * @param name Channel or nickname */ - void cancelAutoWhoOneshot(const QString &channelOrNick); + void cancelAutoWhoOneshot(const QString &name); - bool setAutoWhoDone(const QString &channel); + /** + * Checks if the given target has an automatic WHO in progress, and sets it as done if so + * + * @param name Channel or nickname + * @return True if an automatic WHO is in progress (and should be silenced), otherwise false + */ + bool setAutoWhoDone(const QString &name); void updateIssuedModes(const QString &requestedModes); void updatePersistentModes(QString addModes, QString removeModes);