diff options
author | Timo Sirainen <cras@irssi.org> | 2002-01-10 04:03:34 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-01-10 04:03:34 +0000 |
commit | 4032addbf93d6c5a66ed030579f6be89ead281ac (patch) | |
tree | 5f06d01126d0f0db967a718e2cac7be5e68346b0 /src | |
parent | 805f59d9eed685d77b79bcecf62e22a1ec0ea6a5 (diff) | |
download | irssi-4032addbf93d6c5a66ed030579f6be89ead281ac.zip |
When /SET expand_escapes was ON, \012 and \015 should be treated as newlines
so that text after them is sent as privmsgs, not as direct commands to
server.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2301 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/chat-completion.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index 0c401cfb..6294e452 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -738,23 +738,29 @@ static char *expand_escapes(const char *line, SERVER_REC *server, break; } - switch (*line) { - case 'n': + chr = expand_escape(&line); + if (chr == '\r' || chr == '\n') { /* newline .. we need to send another "send text" event to handle it (or actually the text before the newline..) */ - *ptr = '\0'; - signal_emit("send text", 3, ret, server, item); - ptr = ret; + if (ret != ptr) { + *ptr = '\0'; + signal_emit("send text", 3, ret, server, item); + ptr = ret; + } + } else if (chr != -1) { + /* escaping went ok */ + *ptr++ = chr; + } else { + /* unknown escape, add it as-is */ + *ptr++ = '\\'; + *ptr++ = *line; + } + + switch (*line) { + case 'n': break; default: - chr = expand_escape(&line); - if (chr != -1) - *ptr++ = chr; - else { - *ptr++ = '\\'; - *ptr++ = *line; - } } } |