From 65ae4394fc535ea04b84b9b72d40cf17fc6c90a5 Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Mon, 25 Jul 2011 22:27:52 +0100 Subject: [PATCH] Update for weekly of 2011-07-16; changes to string.Split(). --- client/handlers.go | 6 +++--- client/line.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/handlers.go b/client/handlers.go index d3f896d..adb9298 100644 --- a/client/handlers.go +++ b/client/handlers.go @@ -46,7 +46,7 @@ func (conn *Conn) dispatchEvent(line *Line) { line.Args[1][0] == '\001' && line.Args[1][len(line.Args[1])-1] == '\001' { // WOO, it's a CTCP message - t := strings.Split(line.Args[1][1:len(line.Args[1])-1], " ", 2) + t := strings.SplitN(line.Args[1][1:len(line.Args[1])-1], " ", 2) if len(t) > 1 { // Replace the line with the unwrapped CTCP line.Args[1] = t[1] @@ -257,7 +257,7 @@ func (conn *Conn) h_352(line *Line) { // XXX: do we care about the actual server the nick is on? // or the hop count to this server? // last arg contains " " - a := strings.Split(line.Args[len(line.Args)-1], " ", 2) + a := strings.SplitN(line.Args[len(line.Args)-1], " ", 2) n.Name = a[1] if idx := strings.Index(line.Args[6], "*"); idx != -1 { n.Modes.Oper = true @@ -273,7 +273,7 @@ func (conn *Conn) h_352(line *Line) { // Handle 353 names reply func (conn *Conn) h_353(line *Line) { if ch := conn.GetChannel(line.Args[2]); ch != nil { - nicks := strings.Split(line.Args[len(line.Args)-1], " ", -1) + nicks := strings.Split(line.Args[len(line.Args)-1], " ") for _, nick := range nicks { // UnrealIRCd's coders are lazy and leave a trailing space if nick == "" { diff --git a/client/line.go b/client/line.go index d644add..07116a7 100644 --- a/client/line.go +++ b/client/line.go @@ -41,7 +41,7 @@ func parseLine(s string) *Line { // now we're here, we've parsed a :nick!user@host or :server off // s should contain "cmd args[] :text" - args := strings.Split(s, " :", 2) + args := strings.SplitN(s, " :", 2) if len(args) > 1 { args = append(strings.Fields(args[0]), args[1]) } else {