diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-05 12:37:04 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-05 12:37:04 +0100 |
commit | a6c4e4ed7644c52cb228cb4aa9b2e6cd6b21883b (patch) | |
tree | 1bd44992e7ba8227ea8109cf7623c35e73f5478e /src/gui | |
parent | bffe879db8a6f53d7f74acbed4c162cab1bca409 (diff) | |
download | weechat-a6c4e4ed7644c52cb228cb4aa9b2e6cd6b21883b.zip |
Add weechat_highlight signal, sent when a line with highlight is displayed
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 3 | ||||
-rw-r--r-- | src/gui/gui-chat.c | 59 |
2 files changed, 62 insertions, 0 deletions
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 9c065889b..986725e73 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -346,6 +346,9 @@ gui_main_end (int clean_exit) gui_buffer_close (gui_buffers, 0); } + gui_ok = 0; + gui_init_ok = 0; + /* delete global history */ gui_history_global_free (); diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 8701436dd..2eea85ad7 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -760,6 +760,48 @@ gui_chat_line_get_notify_level (struct t_gui_line *line) } /* + * gui_chat_build_string_prefix_message: build a string with prefix and message + */ + +char * +gui_chat_build_string_prefix_message (struct t_gui_line *line) +{ + char *string, *string_without_colors; + int length; + + length = 0; + if (line->prefix) + length += strlen (line->prefix); + length++; + if (line->message) + length += strlen (line->message); + length++; + + string = malloc (length); + if (string) + { + string[0] = '\0'; + if (line->prefix) + strcat (string, line->prefix); + strcat (string, "\t"); + if (line->message) + strcat (string, line->message); + } + + if (string) + { + string_without_colors = (char *)gui_color_decode ((unsigned char *)string); + if (string_without_colors) + { + free (string); + string = string_without_colors; + } + } + + return string; +} + +/* * gui_chat_line_add: add a new line for a buffer */ @@ -770,6 +812,7 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date, { struct t_gui_line *new_line; struct t_gui_window *ptr_win; + char *message_for_signal; new_line = malloc (sizeof (*new_line)); if (!new_line) @@ -819,7 +862,20 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date, if (new_line->prefix_length > buffer->prefix_max_length) buffer->prefix_max_length = new_line->prefix_length; if (new_line->highlight) + { gui_hotlist_add (buffer, GUI_HOTLIST_HIGHLIGHT, NULL, 1); + if (!weechat_upgrading) + { + message_for_signal = gui_chat_build_string_prefix_message (new_line); + if (message_for_signal) + { + hook_signal_send ("weechat_highlight", + WEECHAT_HOOK_SIGNAL_STRING, + message_for_signal); + free (message_for_signal); + } + } + } else { gui_hotlist_add (buffer, @@ -974,6 +1030,9 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date, { if (!buffer) buffer = gui_buffer_search_main (); + + if (!buffer) + return; if (buffer->type != GUI_BUFFER_TYPE_FORMATED) buffer = gui_buffers; |