From 0ccabead31e46a38a2111caa9745b3ad134df9ec Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Thu, 14 Apr 2016 11:25:23 +1000 Subject: [PATCH] cap: Properly suspend registration for CAP negotiation --- irc/nickname.go | 4 ---- irc/reply.go | 5 ++++- irc/server.go | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/irc/nickname.go b/irc/nickname.go index 5931f244..6c846a1c 100644 --- a/irc/nickname.go +++ b/irc/nickname.go @@ -13,10 +13,6 @@ func (m *NickCommand) HandleRegServer(s *Server) { return } - if client.capState == CapNegotiating { - client.capState = CapNegotiated - } - if m.nickname == "" { client.ErrNoNicknameGiven() return diff --git a/irc/reply.go b/irc/reply.go index 9025d3ca..4caaa6ff 100644 --- a/irc/reply.go +++ b/irc/reply.go @@ -179,7 +179,10 @@ func RplKill(client *Client, target *Client, comment Text) string { } func RplCap(client *Client, subCommand CapSubCommand, arg interface{}) string { - return NewStringReply(nil, CAP, "%s %s :%s", client.Nick(), subCommand, arg) + // client.server needs to be here to workaround a parsing bug in weechat 1.4 + // and let it connect to the server (otherwise it doesn't respond to the CAP + // message with anything and just hangs on connection) + return NewStringReply(client.server, CAP, "%s %s :%s", client.Nick(), subCommand, arg) } // numeric replies diff --git a/irc/server.go b/irc/server.go index e02de0ea..efc7fc67 100644 --- a/irc/server.go +++ b/irc/server.go @@ -387,9 +387,6 @@ func (msg *RFC2812UserCommand) HandleRegServer(server *Server) { func (msg *UserCommand) setUserInfo(server *Server) { client := msg.Client() - if client.capState == CapNegotiating { - client.capState = CapNegotiated - } server.clients.Remove(client) client.username, client.realname = msg.username, msg.realname