Question

I'm building an IRC client and am currently attempting to add SASL support. I have got it working just fine (authentication works), however, there's an annoying "glitch":

As I've understood, the SASL request must be done BEFORE registration, like so:

if (sasl) {
    send("CAP REQ :sasl");
}
send("NICK: " + nick);
send("USER ....");

Now the annoying little thing is that the SASL request causes the IRC server to send back an ERR_NOTREGISTERED (451) reply. Now I could of course just ignore the very first 451 reply if SASL is enabled, but that seems a bit nasty. Am I missing something here?

Was it helpful?

Solution

Well, SASL on IRC is based on the Client CAPability Negotiation.

According to this specification you send a CAP LS at the beginning, after this you send the USER and NICK. If you recive a CAP response before the end of the motd/motd missing, the server supports CAP. Check if SASL is on the list of supported extensions, and request it. If you get the end of motd/motd missing first, the server does not support CAP, and therefore does not support SASL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top