Makes the lib line up more with the irc rfc in message vs args handling
This commit is contained in:
parent
33a06eb72b
commit
e08cb2faf7
16
irc.go
16
irc.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user