diff --git a/irc/conn_test.go b/irc/conn_test.go index 6f781b9c..5cea38a6 100644 --- a/irc/conn_test.go +++ b/irc/conn_test.go @@ -131,7 +131,7 @@ func TestRecv(t *testing.T) { buf.WriteString("001 foo\r\n") c.reader = bufio.NewReader(buf) - c.sendRecv.Add(2) + c.sendRecv.Add(1) go c.recv() assert.Equal(t, "PONG :test\r\n", <-conn.hook) diff --git a/irc/message.go b/irc/message.go index 32a320e3..be4cbfc3 100644 --- a/irc/message.go +++ b/irc/message.go @@ -19,7 +19,7 @@ func (m *Message) LastParam() string { } func parseMessage(line string) *Message { - line = strings.Trim(line, "\r\n") + line = strings.Trim(line, "\r\n ") msg := Message{} cmdStart := 0 cmdEnd := len(line) diff --git a/irc/message_test.go b/irc/message_test.go index da0a74b8..398431a9 100644 --- a/irc/message_test.go +++ b/irc/message_test.go @@ -64,6 +64,18 @@ func TestParseMessage(t *testing.T) { Nick: "ni@ck", Command: "CMD", }, + }, { + "CMD #cake pie \r\n", + &Message{ + Command: "CMD", + Params: []string{"#cake", "pie"}, + }, + }, { + " CMD #cake pie\r\n", + &Message{ + Command: "CMD", + Params: []string{"#cake", "pie"}, + }, }, }