Handle registration failures

References: https://todo.sr.ht/~emersion/soju/30
This commit is contained in:
Simon Ser 2020-06-29 17:52:49 +02:00
parent 0fa07f5f9a
commit d26194f62d
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -1335,6 +1335,11 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
// Ignore
case irc.RPL_STATSVLINE, rpl_statsping, irc.RPL_STATSBLINE, irc.RPL_STATSDLINE:
// Ignore
case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME, irc.ERR_NICKNAMEINUSE, irc.ERR_NICKCOLLISION, irc.ERR_UNAVAILRESOURCE:
if !uc.registered {
return fmt.Errorf("registration failed: %v", msg.Params[len(msg.Params) - 1])
}
fallthrough
default:
uc.logger.Printf("unhandled message: %v", msg)
if downstreamID != 0 {