From c5079f7ac3a063825616b1e150444ac70507db8b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 5 Apr 2023 16:53:18 +0200 Subject: [PATCH] downstream: fix connection registration Fixes: 1df1ccf91ea6 ("downstream: take irc.Message in handleCap") --- downstream.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/downstream.go b/downstream.go index 5518e0c..50b1769 100644 --- a/downstream.go +++ b/downstream.go @@ -744,9 +744,6 @@ func (dc *downstreamConn) handleMessageUnregistered(ctx context.Context, msg *ir dc.logger.Printf("unhandled message: %v", msg) return newUnknownCommandError(msg.Command) } - if dc.registration.nick != "" && dc.registration.username != "" && !dc.registration.negotiatingCaps { - return dc.register(ctx) - } return nil } @@ -1712,6 +1709,10 @@ func (dc *downstreamConn) runUntilRegistered() error { } else if err != nil { return fmt.Errorf("failed to handle IRC command %q: %v", msg, err) } + + if dc.registration.nick != "" && dc.registration.username != "" && !dc.registration.negotiatingCaps { + return dc.register(ctx) + } } return nil