From 7756aef6ff832d8000e0cf585fe5f51ef6d28fbc Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Fri, 20 Oct 2017 19:17:52 -0400 Subject: [PATCH] move cap requests before name registration; fixes #6 --- conn.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/conn.go b/conn.go index dac794c..a46a5dd 100644 --- a/conn.go +++ b/conn.go @@ -288,6 +288,14 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error { c.write(&Event{Command: PASS, Params: []string{c.Config.ServerPass}, Sensitive: true}) } + // List the IRCv3 capabilities, specifically with the max protocol we + // support. The IRCv3 specification doesn't directly state if this should + // be called directly before registration, or if it should be called + // after NICK/USER requests. It looks like non-supporting networks + // should ignore this, and some IRCv3 capable networks require this to + // occur before NICK/USER registration. + c.listCAP() + // Then nickname. c.write(&Event{Command: NICK, Params: []string{c.Config.Nick}}) @@ -298,10 +306,6 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error { c.write(&Event{Command: USER, Params: []string{c.Config.User, "*", "*"}, Trailing: c.Config.Name}) - // List the IRCv3 capabilities, specifically with the max protocol we - // support. - c.listCAP() - // Send a virtual event allowing hooks for successful socket connection. c.RunHandlers(&Event{Command: INITIALIZED, Trailing: c.Server()})