diff --git a/irc.go b/irc.go index 63146bc..90d52b8 100644 --- a/irc.go +++ b/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 { event.Message = args[1] } @@ -77,7 +88,8 @@ func (irc *Connection) readLoop() { if len(args) > 1 { event.Arguments = args[1:len(args)] - } + }*/ + /* XXX: len(args) == 0: args should be empty */ irc.RunCallbacks(event)