summaryrefslogtreecommitdiff
path: root/src/fe-common/core/printtext.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-07-31 22:01:32 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-07-31 22:01:32 +0000
commit01a4f9fe041f29ad39fd3b6ada2f81f312eafded (patch)
tree3929a9443d2d531b89c78531a78fa78c98a84abc /src/fe-common/core/printtext.c
parent059c0f715db30bfe59a5b0a1a77ac45e53c21006 (diff)
downloadirssi-01a4f9fe041f29ad39fd3b6ada2f81f312eafded.zip
Added output_format_get_text() function for querying text formats.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@563 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/printtext.c')
-rw-r--r--src/fe-common/core/printtext.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c
index a07bbbd2..85661d6f 100644
--- a/src/fe-common/core/printtext.c
+++ b/src/fe-common/core/printtext.c
@@ -349,7 +349,7 @@ static void create_dest_rec(TEXT_DEST_REC *dest,
}
static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
- const char *text, va_list args)
+ const char *text, va_list va)
{
GString *out;
char *arglist[10];
@@ -363,7 +363,7 @@ static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
/* read all optional arguments to arglist[] list
so they can be used in any order.. */
- read_arglist(args, format,
+ read_arglist(va, format,
arglist, sizeof(arglist)/sizeof(void*),
buffer, sizeof(buffer));
@@ -405,22 +405,49 @@ static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
return ret;
}
+char *output_format_get_text(const char *module, WINDOW_REC *window,
+ void *server, const char *channel,
+ int formatnum, ...)
+{
+ TEXT_DEST_REC dest;
+ THEME_REC *theme;
+ MODULE_THEME_REC *module_theme;
+ FORMAT_REC *formats;
+ va_list va;
+ char *ret;
+
+ create_dest_rec(&dest, server, channel, 0, window);
+ theme = dest.window->theme == NULL ? current_theme :
+ dest.window->theme;
+
+ module_theme = g_hash_table_lookup(theme->modules, module);
+ formats = g_hash_table_lookup(default_formats, module);
+
+ va_start(va, formatnum);
+ ret = output_format_text_args(&dest, &formats[formatnum],
+ module_theme == NULL ? NULL :
+ module_theme->formats[formatnum], va);
+ va_end(va);
+
+ return ret;
+}
+
static char *output_format_text(TEXT_DEST_REC *dest, int formatnum, ...)
{
THEME_REC *theme;
MODULE_THEME_REC *module_theme;
- va_list args;
+ va_list va;
char *ret;
theme = dest->window->theme == NULL ? current_theme :
dest->window->theme;
module_theme = g_hash_table_lookup(theme->modules, MODULE_NAME);
- va_start(args, formatnum);
+ va_start(va, formatnum);
ret = output_format_text_args(dest, &fecommon_core_formats[formatnum],
module_theme == NULL ? NULL :
- module_theme->formats[formatnum], args);
- va_end(args);
+ module_theme->formats[formatnum], va);
+ va_end(va);
return ret;
}