Handle the reverse case of servers screwing up :

This commit is contained in:
raylu 2010-11-01 23:48:43 -04:00
parent c185010e08
commit 8ce6c4e32e
2 changed files with 9 additions and 2 deletions

View File

@ -222,9 +222,13 @@ func (conn *Conn) recv() {
if len(args) > 1 { if len(args) > 1 {
line.Args = args[1:len(args)] line.Args = args[1:len(args)]
// some servers (Gamesurge) don't use : properly // some servers (Gamesurge) don't use : properly
// so duplicate Args[0] into Text
if line.Text == "" { if line.Text == "" {
line.Text = args[len(args)-1] line.Text = args[len(args)-1]
} }
} else {
// now duplicate Text into Args[0] if no args
line.Args = []string{line.Text}
} }
conn.in <- line conn.in <- line
} }

View File

@ -186,12 +186,15 @@ func (conn *Conn) setupEvents() {
// Handle PARTs from channels to maintain state // Handle PARTs from channels to maintain state
conn.AddHandler("PART", func(conn *Conn, line *Line) { 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) n := conn.GetNick(line.Nick)
if ch != nil && n != nil { if ch != nil && n != nil {
ch.DelNick(n) ch.DelNick(n)
} else { } 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)
} }
}) })