diff --git a/client/line.go b/client/line.go index 8efaa1b..e9d7695 100644 --- a/client/line.go +++ b/client/line.go @@ -61,9 +61,9 @@ func parseLine(s string) *Line { } // So, I think CTCP and (in particular) CTCP ACTION are better handled as - // separate events as opposed to forcing people to have gargantuan PRIVMSG + // separate events as opposed to forcing people to have gargantuan // handlers to cope with the possibilities. - if line.Cmd == "PRIVMSG" && + if (line.Cmd == "PRIVMSG" || line.Cmd == "NOTICE") && len(line.Args[1]) > 2 && strings.HasPrefix(line.Args[1], "\001") && strings.HasSuffix(line.Args[1], "\001") { @@ -73,13 +73,17 @@ func parseLine(s string) *Line { // Replace the line with the unwrapped CTCP line.Args[1] = t[1] } - if c := strings.ToUpper(t[0]); c == "ACTION" { + if c := strings.ToUpper(t[0]); c == "ACTION" && line.Cmd == "PRIVMSG" { // make a CTCP ACTION it's own event a-la PRIVMSG line.Cmd = c } else { - // otherwise, dispatch a generic CTCP event that + // otherwise, dispatch a generic CTCP/CTCPREPLY event that // contains the type of CTCP in line.Args[0] - line.Cmd = "CTCP" + if line.Cmd == "PRIVMSG" { + line.Cmd = "CTCP" + } else { + line.Cmd = "CTCPREPLY" + } line.Args = append([]string{c}, line.Args...) } }