From 8ce6c4e32e845a6338b5f7c5f2c013e03c77b913 Mon Sep 17 00:00:00 2001 From: raylu Date: Mon, 1 Nov 2010 23:48:43 -0400 Subject: [PATCH] Handle the reverse case of servers screwing up : --- irc/connection.go | 4 ++++ irc/handlers.go | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/irc/connection.go b/irc/connection.go index 4cd7546..0d02573 100644 --- a/irc/connection.go +++ b/irc/connection.go @@ -222,9 +222,13 @@ func (conn *Conn) recv() { if len(args) > 1 { line.Args = args[1:len(args)] // some servers (Gamesurge) don't use : properly + // so duplicate Args[0] into Text if line.Text == "" { line.Text = args[len(args)-1] } + } else { + // now duplicate Text into Args[0] if no args + line.Args = []string{line.Text} } conn.in <- line } diff --git a/irc/handlers.go b/irc/handlers.go index fa2c1de..cc84c9a 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -186,12 +186,15 @@ func (conn *Conn) setupEvents() { // Handle PARTs from channels to maintain state conn.AddHandler("PART", func(conn *Conn, line *Line) { - ch := conn.GetChannel(line.Args[0]) + var ch *Channel + if len(line.Args) > 0 { + ch = conn.GetChannel(line.Args[0]) + } n := conn.GetNick(line.Nick) if ch != nil && n != nil { ch.DelNick(n) } else { - conn.error("irc.PART(): buh? PART of channel %s by nick %s", line.Args[0], line.Nick) + conn.error("irc.PART(): buh? %s", line.Raw) } })