diff options
author | Timo Sirainen <cras@irssi.org> | 2000-09-26 22:02:19 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-09-26 22:02:19 +0000 |
commit | 3d627ca527c40f82911058a81df3811ee2cac6a3 (patch) | |
tree | 0fa545cf64e4c5c2a4cbbd8479a685eda4517911 | |
parent | 91b4c3af462fee6fe793dbe17b2145c768522ec6 (diff) | |
download | irssi-3d627ca527c40f82911058a81df3811ee2cac6a3.zip |
if printformat() was given a argument ending with ^C it could mess up
one or two chars of the following text (part/quit messages).
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@676 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/core/printtext.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 155b580f..6566bfa4 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -385,8 +385,18 @@ static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format, ret = parse_special((char **) &str, active_win->active_server, active_win->active, arglist, &need_free, NULL); + if (ret != NULL) { + /* string shouldn't end with \003 or it could + mess up the next one or two characters */ + int diff; + int len = strlen(ret); + while (len > 0 && ret[len-1] == 3) len--; + diff = strlen(ret)-len; + g_string_append(out, ret); + if (diff > 0) + g_string_truncate(out, out->len-diff); if (need_free) g_free(ret); } code = 0; |