From: Shane Synan Date: Mon, 11 Jul 2016 11:04:54 +0000 (-0400) Subject: Try to recover from some bad CAP replies, docs X-Git-Tag: travis-deploy-test~418 X-Git-Url: https://git.quassel-irc.org/?a=commitdiff_plain;h=a9c005dc7e3ab74b00d3c161be3dee52584002bf;p=quassel.git Try to recover from some bad CAP replies, docs Modify CAP ACK and CAP NAK commands to try to continue when possible rather than getting stuck. Fix related documentation. --- diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 7e6a5f4a..5b639b7b 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -212,8 +212,11 @@ void CoreSessionEventProcessor::processIrcEventCap(IrcEvent *e) coreNet->beginCapNegotiation(); } else if (capCommand == "ACK") { // CAP ACK requires at least 3 parameters (no empty response allowed) - if (!checkParamCount(e, 3)) + if (!checkParamCount(e, 3)) { + // If an invalid reply is sent, try to continue rather than getting stuck. + coreNet->sendNextCap(); return; + } // Server: CAP * ACK :multi-prefix sasl // Got the capability we want, handle as needed. @@ -231,8 +234,14 @@ void CoreSessionEventProcessor::processIrcEventCap(IrcEvent *e) } } else if (capCommand == "NAK" || capCommand == "DEL") { // CAP NAK/DEL require at least 3 parameters (no empty response allowed) - if (!checkParamCount(e, 3)) + if (!checkParamCount(e, 3)) { + if (capCommand == "NAK") { + // If an invalid reply is sent, try to continue rather than getting stuck. This + // only matters for denied caps, not removed caps. + coreNet->sendNextCap(); + } return; + } // Either something went wrong with this capability, or it is no longer supported // > For CAP NAK @@ -253,8 +262,8 @@ void CoreSessionEventProcessor::processIrcEventCap(IrcEvent *e) } if (capCommand == "NAK") { - // Continue negotiation when capability listing complete only if this is the result - // of a denied cap, not a removed cap + // Continue negotiation only if this is the result of a denied cap, not a removed + // cap coreNet->sendNextCap(); } }