When a Client is given a nick that's longer than the server's allowed nick length, the server might silently truncate the nick. When RPL_WELCOME is sent, it changes the nick to the correct one.
However, if a user is using SASL, it emits the 'registered' event on either SASL failure or success, which is before RPL_WELCOME. So in the connect callback, if the user is using SASL, client.nick will still be the non-truncated nick. This is why things like matrix-org/matrix-appservice-irc#1393 are happening, the bridge assigns the value of client.nick in the connect callback and stores that for the duration of the connection.
I'm not entirely sure why it's emitting registered on SASL replies, since RPL_WELCOME will be sent no matter what.
When a
Clientis given a nick that's longer than the server's allowed nick length, the server might silently truncate the nick. WhenRPL_WELCOMEis sent, it changes the nick to the correct one.However, if a user is using SASL, it emits the 'registered' event on either SASL failure or success, which is before
RPL_WELCOME. So in theconnectcallback, if the user is using SASL,client.nickwill still be the non-truncated nick. This is why things like matrix-org/matrix-appservice-irc#1393 are happening, the bridge assigns the value ofclient.nickin the connect callback and stores that for the duration of the connection.I'm not entirely sure why it's emitting
registeredon SASL replies, sinceRPL_WELCOMEwill be sent no matter what.