From d26194f62dbad27774f06bbbcfdcb57f739ad92b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 29 Jun 2020 17:52:49 +0200 Subject: [PATCH] Handle registration failures References: https://todo.sr.ht/~emersion/soju/30 --- upstream.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/upstream.go b/upstream.go index a0f5d69..4d93221 100644 --- a/upstream.go +++ b/upstream.go @@ -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 {