downstream: fix connection registration

Fixes: 1df1ccf91e ("downstream: take irc.Message in handleCap")
This commit is contained in:
Simon Ser 2023-04-05 16:53:18 +02:00
parent 0b1a4b9081
commit c5079f7ac3

View File

@ -744,9 +744,6 @@ func (dc *downstreamConn) handleMessageUnregistered(ctx context.Context, msg *ir
dc.logger.Printf("unhandled message: %v", msg) dc.logger.Printf("unhandled message: %v", msg)
return newUnknownCommandError(msg.Command) return newUnknownCommandError(msg.Command)
} }
if dc.registration.nick != "" && dc.registration.username != "" && !dc.registration.negotiatingCaps {
return dc.register(ctx)
}
return nil return nil
} }
@ -1712,6 +1709,10 @@ func (dc *downstreamConn) runUntilRegistered() error {
} else if err != nil { } else if err != nil {
return fmt.Errorf("failed to handle IRC command %q: %v", msg, err) 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 return nil