mirror of https://github.com/fluffle/goirc
Handle the reverse case of servers screwing up :
This commit is contained in:
parent
c185010e08
commit
8ce6c4e32e
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue