From d5ded8f97721f1326d41b80ef5746365a8547223 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 5 Aug 2002 01:38:49 +0000 Subject: [PATCH] Changed CTCP handler to remove the later \001 only if it was at the end of the line, so you couldn't hide text by typing eg. \001foo\001hidden text. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2870 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/ctcp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/irc/core/ctcp.c b/src/irc/core/ctcp.c index 5b52fb71..8bd54c0c 100644 --- a/src/irc/core/ctcp.c +++ b/src/irc/core/ctcp.c @@ -269,7 +269,8 @@ static void ctcp_reply(IRC_SERVER_REC *server, const char *data, static void event_privmsg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { - char *params, *target, *msg, *ptr; + char *params, *target, *msg; + int len; g_return_if_fail(data != NULL); @@ -277,9 +278,11 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data, /* handle only ctcp messages.. */ if (*msg == 1) { - /* remove the later \001 */ - ptr = strrchr(++msg, 1); - if (ptr != NULL) *ptr = '\0'; + /* remove the \001 at beginning and end */ + msg++; + len = strlen(msg); + if (msg[len-1] == '\001') + msg[len-1] = '\0'; signal_emit("ctcp msg", 5, server, msg, nick, addr, target); signal_stop();