summaryrefslogtreecommitdiff
path: root/src/irc/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-08-05 01:38:49 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-08-05 01:38:49 +0000
commitd5ded8f97721f1326d41b80ef5746365a8547223 (patch)
tree520dfb4fc0d499df7edca1c12466160767f82be2 /src/irc/core
parent0a1e18b50d014f6438e43c491182c2276470942c (diff)
downloadirssi-d5ded8f97721f1326d41b80ef5746365a8547223.zip
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
Diffstat (limited to 'src/irc/core')
-rw-r--r--src/irc/core/ctcp.c11
1 files 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();