From 2b881146d737a0ec13571d8ab5a94c7a8a39d0fc Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 30 Oct 2014 02:52:51 +0000 Subject: [PATCH] Try to fix args --- src/wirc/wirc.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/wirc/wirc.go b/src/wirc/wirc.go index 2a48230..72b28d0 100644 --- a/src/wirc/wirc.go +++ b/src/wirc/wirc.go @@ -9,6 +9,7 @@ import ( "logfile" "net" "os" + "strconv" "strings" "time" ) @@ -114,7 +115,6 @@ func parse(v string) (Message, error) { m.FullSender = "." m.Forum = "." m.Sender = "." - m.Args = parts parts = strings.Split(lhs, " ") if parts[0][0] == ':' { @@ -140,6 +140,7 @@ func parse(v string) (Message, error) { } case "PART", "MODE", "TOPIC", "KICK": m.Forum = parts[1] + m.Args = parts[2:] case "JOIN": if len(parts) == 1 { m.Forum = m.Text @@ -157,11 +158,23 @@ func parse(v string) (Message, error) { case "NICK": if len(parts) > 1 { m.Sender = parts[1] + m.Args = parts[2:] } else { m.Sender = m.Text m.Text = "" + m.Args = parts[1:] } m.Forum = m.Sender + case "353": + m.Forum = parts[3] + default: + numeric, _ := strconv.Atoi(m.Command) + if numeric >= 300 { + if len(parts) > 2 { + m.Forum = parts[2] + } + } + m.Args = parts[1:] } return m, nil