diff options
author | Patrick Griffis <tingping@tingping.se> | 2017-10-07 17:31:53 -0400 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2017-10-07 17:31:53 -0400 |
commit | 4188f26ab981324d91217277294f52e85192201e (patch) | |
tree | 96044f336b23ebfb1752a1971d805ca4b1763c52 /src/common | |
parent | 07f1fc60dac480d3e4ca8e98ec1c0e08c050676d (diff) |
Improve CTCP notice handling
Cutting off all text after \001 can result in users hiding text so lets only bother handling it if it is a valid CTCP message (starting and ending with \001).
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/inbound.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c index 6931bdc1..8d299ed8 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -932,7 +932,7 @@ void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id, const message_tags_data *tags_data) { - char *po,*ptr=to; + char *ptr = to; session *sess = 0; int server_notice = FALSE; @@ -1005,18 +1005,21 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id, } } - if (msg[0] == 1) + if (msg[0] == '\001') { + size_t len; + msg++; if (!strncmp (msg, "PING", 4)) { inbound_ping_reply (sess, msg + 5, nick, tags_data); return; } + + len = strlen(msg); + if (msg[len - 1] == '\001') + msg[len - 1] = '\000'; } - po = strchr (msg, '\001'); - if (po) - po[0] = 0; if (server_notice) EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, msg, nick, NULL, NULL, 0, |