Read nickname from RPL_WELCOME

References: https://github.com/ircdocs/modern-irc/pull/146
This commit is contained in:
Simon Ser 2021-12-06 17:58:54 +01:00
parent 1c285a1b72
commit 548b1c6930

View File

@ -690,8 +690,13 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
dc.SendMessage(msg)
}
case irc.RPL_WELCOME:
if err := parseMessageParams(msg, &uc.nick); err != nil {
return err
}
uc.registered = true
uc.logger.Printf("connection registered")
uc.nickCM = uc.network.casemap(uc.nick)
uc.logger.Printf("connection registered with nick %q", uc.nick)
if uc.network.channels.Len() > 0 {
var channels, keys []string