|
@ -2,6 +2,7 @@ package irc |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
"fmt" |
|
|
"strings" |
|
|
"strings" |
|
|
"time" |
|
|
"time" |
|
|
) |
|
|
) |
|
@ -63,7 +64,7 @@ func ParsePacket(line string) (Event, error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Parse body
|
|
|
// Parse body
|
|
|
split := strings.Split(line, " :") |
|
|
|
|
|
|
|
|
split := strings.SplitN(line, " :", 2) |
|
|
tokens := strings.Split(split[0], " ") |
|
|
tokens := strings.Split(split[0], " ") |
|
|
|
|
|
|
|
|
if len(split) == 2 { |
|
|
if len(split) == 2 { |
|
@ -73,6 +74,8 @@ func ParsePacket(line string) (Event, error) { |
|
|
event.verb = tokens[0] |
|
|
event.verb = tokens[0] |
|
|
event.Args = tokens[1:] |
|
|
event.Args = tokens[1:] |
|
|
|
|
|
|
|
|
|
|
|
fmt.Printf("%#+v\n", split) |
|
|
|
|
|
|
|
|
// Parse CTCP
|
|
|
// Parse CTCP
|
|
|
if (event.verb == "PRIVMSG" || event.verb == "NOTICE") && strings.HasPrefix(event.Text, "\x01") { |
|
|
if (event.verb == "PRIVMSG" || event.verb == "NOTICE") && strings.HasPrefix(event.Text, "\x01") { |
|
|
verbtext := strings.SplitN(strings.Replace(event.Text, "\x01", "", 2), " ", 2) |
|
|
verbtext := strings.SplitN(strings.Replace(event.Text, "\x01", "", 2), " ", 2) |
|
|