From d088b73396236c8825b7f54d38bc80b2dc342af1 Mon Sep 17 00:00:00 2001 From: Dumb Thing Date: Wed, 6 Aug 2014 00:27:45 +0200 Subject: [PATCH] no longer breaks on invalid ctcp requests --- irc_callback.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/irc_callback.go b/irc_callback.go index c941a11..c782379 100644 --- a/irc_callback.go +++ b/irc_callback.go @@ -90,7 +90,7 @@ func (irc *Connection) RunCallbacks(event *Event) { } else if msg == "TIME" { event.Code = "CTCP_TIME" - } else if msg[0:4] == "PING" { + } else if strings.HasPrefix(msg, "PING") { event.Code = "CTCP_PING" } else if msg == "USERINFO" { @@ -99,10 +99,11 @@ func (irc *Connection) RunCallbacks(event *Event) { } else if msg == "CLIENTINFO" { event.Code = "CTCP_CLIENTINFO" - } else if msg[0:6] == "ACTION" { + } else if strings.HasPrefix(msg, "ACTION") { event.Code = "CTCP_ACTION" msg = msg[7:] } + event.Arguments[len(event.Arguments)-1] = msg }