summaryrefslogtreecommitdiff
path: root/src/core/special-vars.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-03 21:34:06 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-03 21:34:06 +0000
commitd4558de2327ab5b38720bfad6d079e5878c94d72 (patch)
treebe5013f36991f35d074c62ccc9b5c65897ca9920 /src/core/special-vars.c
parent9a5b97164e99d90f91ef497acad05480795ec5a8 (diff)
downloadirssi-d4558de2327ab5b38720bfad6d079e5878c94d72.zip
/SET prompt - if target had %c or something in it, it shouldn't be
treated as color code. So color codes can now be used in /SET prompt string itself, but in none of the $variables it uses. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1324 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/special-vars.c')
-rw-r--r--src/core/special-vars.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/special-vars.c b/src/core/special-vars.c
index 62202a20..40372f93 100644
--- a/src/core/special-vars.c
+++ b/src/core/special-vars.c
@@ -435,6 +435,16 @@ char *parse_special(char **cmd, SERVER_REC *server, void *item,
return value;
}
+static void gstring_append_escaped(GString *str, const char *text)
+{
+ while (*text != '\0') {
+ if (*text == '%')
+ g_string_append_c(str, '%');
+ g_string_append_c(str, *text);
+ text++;
+ }
+}
+
/* parse the whole string. $ and \ chars are replaced */
char *parse_special_string(const char *cmd, SERVER_REC *server, void *item,
const char *data, int *arg_used, int flags)
@@ -472,7 +482,10 @@ char *parse_special_string(const char *cmd, SERVER_REC *server, void *item,
arglist, &need_free, arg_used,
flags);
if (ret != NULL) {
- g_string_append(str, ret);
+ if ((flags & PARSE_FLAG_ESCAPE_VARS) == 0)
+ g_string_append(str, ret);
+ else
+ gstring_append_escaped(str, ret);
if (need_free) g_free(ret);
}
code = 0;