From f4bccff9c485c977ff027954497b3c4c397ffa1a Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Thu, 26 May 2016 22:22:25 -0400 Subject: [PATCH] Format SASL auth messages Display SASL authentication messages with cleaner formatting. Special-case RPL_LOGGEDIN and RPL_LOGGEDOUT to avoid showing the nick/hostmask jumble. --- src/core/eventstringifier.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index 218eeea3..186fe130 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -205,15 +205,29 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) case 376: break; - // CAP stuff - case 900: - case 903: - case 904: - case 905: - case 906: - case 907: + // SASL authentication stuff + // See: http://ircv3.net/specs/extensions/sasl-3.1.html + case 900: // RPL_LOGGEDIN + case 901: // RPL_LOGGEDOUT { - displayMsg(e, Message::Info, "CAP: " + e->params().join("")); + // :server 900 !@ :You are now logged in as + // :server 901 !@ :You are now logged out + if (!checkParamCount(e, 3)) + return; + displayMsg(e, Message::Server, "SASL: " + e->params().at(2)); + break; + } + // Ignore SASL success, partially redundant with RPL_LOGGEDIN and RPL_LOGGEDOUT + case 903: // RPL_SASLSUCCESS :server 903 :SASL authentication successful + break; + case 902: // ERR_NICKLOCKED :server 902 :You must use a nick assigned to you + case 904: // ERR_SASLFAIL :server 904 :SASL authentication failed + case 905: // ERR_SASLTOOLONG :server 905 :SASL message too long + case 906: // ERR_SASLABORTED :server 906 :SASL authentication aborted + case 907: // ERR_SASLALREADY :server 907 :You have already authenticated using SASL + case 908: // RPL_SASLMECHS :server 908 :are available SASL mechanisms + { + displayMsg(e, Message::Server, "SASL: " + e->params().join("")); break; } -- 2.20.1