Makes the lib line up more with the irc rfc in message vs args handling

This commit is contained in:
Kaleb Elwert 2014-02-11 04:00:35 -05:00 committed by Thomas Jager
parent 33a06eb72b
commit e08cb2faf7

16
irc.go
View File

@ -67,7 +67,18 @@ func (irc *Connection) readLoop() {
} }
} }
args := strings.SplitN(msg, " :", 2) split := strings.SplitN(msg, " :", 2)
args := strings.Split(split[0], " ")
event.Code = strings.ToUpper(args[0])
event.Arguments = args[1:]
if len(split) > 1 {
event.Arguments = append(event.Arguments, split[1])
}
if len(event.Arguments) > 0 {
event.Message = event.Arguments[len(event.Arguments)-1]
}
/*args := strings.SplitN(msg, " :", 2)
if len(args) > 1 { if len(args) > 1 {
event.Message = args[1] event.Message = args[1]
} }
@ -77,7 +88,8 @@ func (irc *Connection) readLoop() {
if len(args) > 1 { if len(args) > 1 {
event.Arguments = args[1:len(args)] event.Arguments = args[1:len(args)]
} }*/
/* XXX: len(args) == 0: args should be empty */ /* XXX: len(args) == 0: args should be empty */
irc.RunCallbacks(event) irc.RunCallbacks(event)