Hide AutoWho reply if channel/nick quits
authorShane Synan <digitalcircuit36939@gmail.com>
Thu, 26 May 2016 23:04:53 +0000 (19:04 -0400)
committerShane Synan <digitalcircuit36939@gmail.com>
Mon, 13 Jun 2016 21:00:49 +0000 (17:00 -0400)
If the given nick quits or channel is removed during an AutoWho, hide
the ERR_NOSUCHCHANNEL reply, since the WHO reply would've been hidden
too.  Avoids showing the confusing "No such channel" error in the
status buffer.

src/core/coresessioneventprocessor.cpp
src/core/coresessioneventprocessor.h

index f86b103..8acae81 100644 (file)
@@ -1092,6 +1092,22 @@ void CoreSessionEventProcessor::processWhoInformation (Network *net, const QStri
 }
 
 
+/* ERR_NOSUCHCHANNEL - "<channel name> :No such channel" */
+void CoreSessionEventProcessor::processIrcEvent403(IrcEventNumeric *e)
+{
+    // If this is the result of an AutoWho, hide it.  It's confusing to show to the user.
+    if (!checkParamCount(e, 2))
+        return;
+
+    QString channelOrNick = e->params()[0];
+    // Check if channel name has a who in progress.
+    // If not, then check if user nick exists and has a who in progress.
+    if (coreNetwork(e)->isAutoWhoInProgress(channelOrNick)) {
+        qDebug() << "Channel/nick" << channelOrNick << "no longer exists during AutoWho, ignoring";
+        e->setFlag(EventManager::Silent);
+    }
+}
+
 /* ERR_ERRONEUSNICKNAME */
 void CoreSessionEventProcessor::processIrcEvent432(IrcEventNumeric *e)
 {
index 9d5917e..3a1070d 100644 (file)
@@ -91,6 +91,7 @@ public:
     Q_INVOKABLE void processIrcEvent352(IrcEvent *event);          // RPL_WHOREPLY
     Q_INVOKABLE void processIrcEvent353(IrcEvent *event);          // RPL_NAMREPLY
     Q_INVOKABLE void processIrcEvent354(IrcEvent *event);          // RPL_WHOSPCRPL
+    Q_INVOKABLE void processIrcEvent403(IrcEventNumeric *event);   // ERR_NOSUCHCHANNEL
     Q_INVOKABLE void processIrcEvent432(IrcEventNumeric *event);   // ERR_ERRONEUSNICKNAME
     Q_INVOKABLE void processIrcEvent433(IrcEventNumeric *event);   // ERR_NICKNAMEINUSE
     Q_INVOKABLE void processIrcEvent437(IrcEventNumeric *event);   // ERR_UNAVAILRESOURCE