fix: only join the initial channel after registration is complete

During registration, only a subset of commands are allowed.
Servers MUST send a RPL_WELCOME (001) after registration is complete so
we join the channel in response to that numeric reply.

https://modern.ircdocs.horse/#connection-registration
This commit is contained in:
2025-08-15 22:18:55 +02:00
parent 1d10198d37
commit 026021c118
3 changed files with 11 additions and 5 deletions
+3 -4
View File
@@ -84,6 +84,9 @@ type Client struct {
// Active channel index
ActiveChannelIndex int
// The channel to join immediately after registration completes.
InitialChannel string
// Reference to the bubbletea program
Tea *tea.Program
@@ -213,10 +216,6 @@ func (c *Client) Register(nick string, password string, channel string) {
// set user-wanted nickname
c.Nickname = nick
c.SendCommand(commands.USER, nick, "0", "*", nick)
// joining a channel when registering is optional
if channel != "" {
c.SendCommand(commands.JOIN, channel)
}
}
func (c *Client) SetDay() {