summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-01-10 04:03:34 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-01-10 04:03:34 +0000
commit4032addbf93d6c5a66ed030579f6be89ead281ac (patch)
tree5f06d01126d0f0db967a718e2cac7be5e68346b0
parent805f59d9eed685d77b79bcecf62e22a1ec0ea6a5 (diff)
downloadirssi-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
-rw-r--r--src/fe-common/core/chat-completion.c30
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;
- }
}
}