fix name reply parsing

This commit is contained in:
blackbeard420 2020-09-03 23:29:52 -04:00
parent 8ceea92416
commit e6ff641232
2 changed files with 5 additions and 6 deletions

9
irc.go
View File

@ -13,7 +13,7 @@ import (
const ( const (
//IrcVersion exports the current version of the irc lib //IrcVersion exports the current version of the irc lib
IrcVersion = "0.1.0" IrcVersion = "0.1.1776"
) )
//Connection holds the callbacks for the client //Connection holds the callbacks for the client
@ -212,10 +212,9 @@ func (c *Connection) parseMessage(line string) {
} }
if cmd == "353" { if cmd == "353" {
idx := strings.Index(args, "=") + 2 params := strings.SplitN(args, " ", 4)
s := strings.Split(args[idx:], ":") target := strings.TrimSpace(params[2])
target := strings.TrimSpace(s[0]) c.updateNicks(target, strings.Split(params[3][1:], " "))
c.updateNicks(target, strings.Split(s[1], " "))
} }
if c.NumericCallback != nil { if c.NumericCallback != nil {

View File

@ -8,7 +8,7 @@ import (
) )
func TestSimpleIrc(t *testing.T) { 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() go con.Run()