1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

Add weechat_highlight signal, sent when a line with highlight is displayed

This commit is contained in:
Sebastien Helleu
2008-11-05 12:37:04 +01:00
parent bffe879db8
commit a6c4e4ed76
4 changed files with 67 additions and 3 deletions
+4 -3
View File
@@ -71,9 +71,9 @@
int weechat_debug_core = 0; /* debug level for core */
char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0])*/
int weechat_upgrading; /* =1 if WeeChat is upgrading */
time_t weechat_start_time; /* start time (used by /uptime cmd) */
int weechat_quit; /* = 1 if quit request from user */
int weechat_upgrading = 0; /* =1 if WeeChat is upgrading */
time_t weechat_start_time = 0; /* start time (used by /uptime cmd) */
int weechat_quit = 0; /* = 1 if quit request from user */
int weechat_sigsegv = 0; /* SIGSEGV received? */
char *weechat_home = NULL; /* home dir. (default: ~/.weechat) */
char *weechat_local_charset = NULL; /* example: ISO-8859-1, UTF-8 */
@@ -400,6 +400,7 @@ main (int argc, char *argv[])
argc, argv);
command_startup (1); /* command executed after plugins */
gui_layout_window_apply (); /* apply saved layout for windows */
weechat_upgrading = 0;
gui_main_loop (); /* WeeChat main loop */
+1
View File
@@ -100,6 +100,7 @@
extern int weechat_debug_core;
extern char *weechat_argv0;
extern int weechat_upgrading;
extern time_t weechat_start_time;
extern int weechat_quit;
extern char *weechat_home;
+3
View File
@@ -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 ();
+59
View File
@@ -759,6 +759,48 @@ gui_chat_line_get_notify_level (struct t_gui_line *line)
return GUI_HOTLIST_LOW;
}
/*
* 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;