Browse Source

event: Fixed all CTCP events being parsed as ctcp-reply kind.

master
Gisle Aune 6 years ago
parent
commit
2dd72f9838
  1. 12
      event_packet.go

12
event_packet.go

@ -77,18 +77,18 @@ func ParsePacket(line string) (Event, error) {
if (event.verb == "PRIVMSG" || event.verb == "NOTICE") && strings.HasPrefix(event.Text, "\x01") {
verbtext := strings.SplitN(strings.Replace(event.Text, "\x01", "", 2), " ", 2)
if event.verb == "PRIVMSG" {
event.kind = "ctcp"
} else {
event.kind = "ctcp-reply"
}
event.verb = verbtext[0]
if len(verbtext) == 2 {
event.Text = verbtext[1]
} else {
event.Text = ""
}
if event.verb == "PRIVMSG" {
event.kind = "ctcp"
} else {
event.kind = "ctcp-reply"
}
}
event.name = event.kind + "." + strings.ToLower(event.verb)

Loading…
Cancel
Save