From e6ff64123204683caff2216509c793351dfbd019 Mon Sep 17 00:00:00 2001 From: blackbeard420 Date: Thu, 3 Sep 2020 23:29:52 -0400 Subject: [PATCH] fix name reply parsing --- irc.go | 9 ++++----- irc_test.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/irc.go b/irc.go index e57a502..5e7ddb8 100644 --- a/irc.go +++ b/irc.go @@ -13,7 +13,7 @@ import ( const ( //IrcVersion exports the current version of the irc lib - IrcVersion = "0.1.0" + IrcVersion = "0.1.1776" ) //Connection holds the callbacks for the client @@ -212,10 +212,9 @@ func (c *Connection) parseMessage(line string) { } if cmd == "353" { - idx := strings.Index(args, "=") + 2 - s := strings.Split(args[idx:], ":") - target := strings.TrimSpace(s[0]) - c.updateNicks(target, strings.Split(s[1], " ")) + params := strings.SplitN(args, " ", 4) + target := strings.TrimSpace(params[2]) + c.updateNicks(target, strings.Split(params[3][1:], " ")) } if c.NumericCallback != nil { diff --git a/irc_test.go b/irc_test.go index c4dd64d..3a4750e 100644 --- a/irc_test.go +++ b/irc_test.go @@ -8,7 +8,7 @@ import ( ) func TestSimpleIrc(t *testing.T) { - con := NewConnection("thc420.xyz:6667", "irc-go", "irc-go", nil, []string{"#freedom"}) + con := NewConnection("thc420.xyz:6667", "irc-go", "irc-go", nil, []string{"#freedom", "#test"}) go con.Run()