degesch: fix CTCP handling
In `/me :\` practically no client bothers to escape the backslash but we used to interpret it as the start of an escape sequence anyway. Silly us, no one respects any standards.
This commit is contained in:
parent
db17223df0
commit
5613c326c9
14
common.c
14
common.c
@ -1023,6 +1023,13 @@ ctcp_intra_decode (const char *chunk, size_t len, struct str *output)
|
||||
}
|
||||
}
|
||||
|
||||
// According to the original CTCP specification we should use
|
||||
// ctcp_intra_decode() on all parts, however no one seems to use that
|
||||
// and it breaks normal text with backslashes
|
||||
#ifndef SUPPORT_CTCP_X_QUOTES
|
||||
#define ctcp_intra_decode(s, len, output) str_append_data (output, s, len)
|
||||
#endif
|
||||
|
||||
static void
|
||||
ctcp_parse_tagged (const char *chunk, size_t len, struct ctcp_chunk *output)
|
||||
{
|
||||
@ -1051,9 +1058,6 @@ ctcp_parse (const char *message)
|
||||
|
||||
struct ctcp_chunk *result = NULL, *result_tail = NULL;
|
||||
|
||||
// According to the original CTCP specification we should use
|
||||
// ctcp_intra_decode() on all parts, however no one seems to
|
||||
// use that and it breaks normal text with backslashes
|
||||
size_t start = 0;
|
||||
bool in_ctcp = false;
|
||||
for (size_t i = 0; i < m.len; i++)
|
||||
@ -1077,7 +1081,7 @@ ctcp_parse (const char *message)
|
||||
if (my_is_ctcp)
|
||||
ctcp_parse_tagged (m.str + my_start, i - my_start, chunk);
|
||||
else
|
||||
str_append_data (&chunk->text, m.str + my_start, i - my_start);
|
||||
ctcp_intra_decode (m.str + my_start, i - my_start, &chunk->text);
|
||||
LIST_APPEND_WITH_TAIL (result, result_tail, chunk);
|
||||
}
|
||||
|
||||
@ -1091,7 +1095,7 @@ ctcp_parse (const char *message)
|
||||
chunk->is_partial = true;
|
||||
}
|
||||
else
|
||||
str_append_data (&chunk->text, m.str + start, m.len - start);
|
||||
ctcp_intra_decode (m.str + start, m.len - start, &chunk->text);
|
||||
LIST_APPEND_WITH_TAIL (result, result_tail, chunk);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user