summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-05 08:34:39 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-05 08:34:39 +0000
commit19d111eff42e2a2d8424383994e9962f611fd912 (patch)
tree674b907d1f0c2b88ec30cbf2be1bfcbdd52198aa
parent86aa2d514dd5af8b124968aeb610d1f2ca29b22f (diff)
downloadirssi-19d111eff42e2a2d8424383994e9962f611fd912.zip
printtext_string() fix, should actually work now :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1073 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/core/printtext.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c
index 5072e783..6e21ed4d 100644
--- a/src/fe-common/core/printtext.c
+++ b/src/fe-common/core/printtext.c
@@ -219,6 +219,32 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str, va_list va
return ret;
}
+static char *printtext_expand_formats(TEXT_DEST_REC *dest, const char *str)
+{
+ GString *out;
+ char *ret;
+
+ out = g_string_new(NULL);
+ for (; *str != '\0'; str++) {
+ if (*str != '%') {
+ g_string_append_c(out, *str);
+ continue;
+ }
+
+ if (*++str == '\0')
+ break;
+
+ if (!format_expand_styles(out, *str, dest)) {
+ g_string_append_c(out, '%');
+ g_string_append_c(out, *str);
+ }
+ }
+
+ ret = out->str;
+ g_string_free(out, FALSE);
+ return ret;
+}
+
void printtext_dest(TEXT_DEST_REC *dest, const char *text, va_list va)
{
char *str;
@@ -253,6 +279,7 @@ void printtext(void *server, const char *target, int level, const char *text, ..
void printtext_string(void *server, const char *target, int level, const char *text)
{
TEXT_DEST_REC dest;
+ char *str;
g_return_if_fail(text != NULL);
@@ -264,7 +291,9 @@ void printtext_string(void *server, const char *target, int level, const char *t
sending_print_starting = FALSE;
}
- print_line(&dest, text);
+ str = printtext_expand_formats(&dest, text);
+ print_line(&dest, str);
+ g_free(str);
}
void printtext_window(WINDOW_REC *window, int level, const char *text, ...)