diff options
author | Timo Sirainen <cras@irssi.org> | 2000-11-30 01:41:11 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-11-30 01:41:11 +0000 |
commit | 18a918791ea8d8d781e688bf262b3d53e63d7607 (patch) | |
tree | 7de618056ae34946f4df6c6dd7fecd7307f1034b /src | |
parent | cbf45ea6bfeb12c4b7f98c66c5ffcf204f81a8ce (diff) | |
download | irssi-18a918791ea8d8d781e688bf262b3d53e63d7607.zip |
send "print starting" signal before each printformat() or printtext()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@899 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/printtext.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 3844174a..f5bde71d 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -39,6 +39,9 @@ static int signal_print_text_stripped; static int signal_print_text; static int signal_print_text_finished; static int signal_print_format; +static int signal_print_starting; + +static int sending_print_starting; static void print_line(TEXT_DEST_REC *dest, const char *text); @@ -65,6 +68,12 @@ static void printformat_module_dest(const char *module, TEXT_DEST_REC *dest, arglist, sizeof(arglist)/sizeof(char *), buffer, sizeof(buffer)); + if (!sending_print_starting) { + sending_print_starting = TRUE; + signal_emit_id(signal_print_starting, 1, dest); + sending_print_starting = FALSE; + } + signal_emit_id(signal_print_format, 5, theme, module, dest, GINT_TO_POINTER(formatnum), arglist); @@ -210,11 +219,25 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str, va_list va return ret; } +void printtext_dest(TEXT_DEST_REC *dest, const char *text, va_list va) +{ + char *str; + + if (!sending_print_starting) { + sending_print_starting = TRUE; + signal_emit_id(signal_print_starting, 1, dest); + sending_print_starting = FALSE; + } + + str = printtext_get_args(dest, text, va); + print_line(dest, str); + g_free(str); +} + /* Write text to target - convert color codes */ void printtext(void *server, const char *target, int level, const char *text, ...) { TEXT_DEST_REC dest; - char *str; va_list va; g_return_if_fail(text != NULL); @@ -222,17 +245,13 @@ void printtext(void *server, const char *target, int level, const char *text, .. format_create_dest(&dest, server, target, level, NULL); va_start(va, text); - str = printtext_get_args(&dest, text, va); + printtext_dest(&dest, text, va); va_end(va); - - print_line(&dest, str); - g_free(str); } void printtext_window(WINDOW_REC *window, int level, const char *text, ...) { TEXT_DEST_REC dest; - char *str; va_list va; g_return_if_fail(text != NULL); @@ -241,11 +260,8 @@ void printtext_window(WINDOW_REC *window, int level, const char *text, ...) window != NULL ? window : active_win); va_start(va, text); - str = printtext_get_args(&dest, text, va); + printtext_dest(&dest, text, va); va_end(va); - - print_line(&dest, str); - g_free(str); } static void msg_beep_check(SERVER_REC *server, int level) @@ -319,11 +335,13 @@ void printtext_init(void) { settings_add_int("misc", "timestamp_timeout", 0); + sending_print_starting = FALSE; signal_gui_print_text = signal_get_uniq_id("gui print text"); signal_print_text_stripped = signal_get_uniq_id("print text stripped"); signal_print_text = signal_get_uniq_id("print text"); signal_print_text_finished = signal_get_uniq_id("print text finished"); signal_print_format = signal_get_uniq_id("print format"); + signal_print_starting = signal_get_uniq_id("print starting"); read_settings(); signal_add("print text", (SIGNAL_FUNC) sig_print_text); |