diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-05-04 18:00:51 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-05-04 18:00:51 +0200 |
commit | 917e111b784479e449a7602225065ca64857a319 (patch) | |
tree | 241e45b50bde66010fd30459b54a575916aecd78 /src | |
parent | ddb16b7c0e7f922d6cc0c3e67ff66381cd445899 (diff) | |
download | weechat-917e111b784479e449a7602225065ca64857a319.zip |
Disable print hooks during display of backlog (in logger plugin)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-buffer.c | 13 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 | ||||
-rw-r--r-- | src/gui/gui-chat.c | 2 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 135a5919e..f7ebce87d 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -397,6 +397,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, new_buffer->type = GUI_BUFFER_TYPE_FORMATED; new_buffer->notify = CONFIG_INTEGER(config_look_buffer_notify_default); new_buffer->num_displayed = 0; + new_buffer->print_hooks_enabled = 1; /* close callback */ new_buffer->close_callback = close_callback; @@ -637,6 +638,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property) return buffer->number; else if (string_strcasecmp (property, "num_displayed") == 0) return buffer->num_displayed; + else if (string_strcasecmp (property, "print_hooks_enabled") == 0) + return buffer->print_hooks_enabled; else if (string_strcasecmp (property, "notify") == 0) return buffer->notify; else if (string_strcasecmp (property, "lines_hidden") == 0) @@ -961,6 +964,13 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, (string_strcasecmp (value, "auto") == 0) ? 0 : 1); } + else if (string_strcasecmp (property, "print_hooks_enabled") == 0) + { + error = NULL; + number = strtol (value, &error, 10); + if (error && !error[0]) + buffer->print_hooks_enabled = (number) ? 1 : 0; + } else if (string_strcasecmp (property, "name") == 0) { gui_buffer_set_name (buffer, value); @@ -1645,6 +1655,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_integer (ptr_item, "num_displayed", buffer->num_displayed)) return 0; + if (!infolist_new_var_integer (ptr_item, "print_hooks_enabled", buffer->print_hooks_enabled)) + return 0; if (!infolist_new_var_integer (ptr_item, "first_line_not_read", buffer->first_line_not_read)) return 0; if (!infolist_new_var_integer (ptr_item, "lines_hidden", buffer->lines_hidden)) @@ -1883,6 +1895,7 @@ gui_buffer_print_log () log_printf (" type . . . . . . . . . : %d", ptr_buffer->type); log_printf (" notify . . . . . . . . : %d", ptr_buffer->notify); log_printf (" num_displayed. . . . . : %d", ptr_buffer->num_displayed); + log_printf (" print_hooks_enabled. . : %d", ptr_buffer->print_hooks_enabled); log_printf (" close_callback . . . . : 0x%lx", ptr_buffer->close_callback); log_printf (" close_callback_data. . : 0x%lx", ptr_buffer->close_callback_data); log_printf (" title. . . . . . . . . : '%s'", ptr_buffer->title); diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 0f773eefa..80e92f890 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -95,6 +95,7 @@ struct t_gui_buffer /* 2 = highlight + msg */ /* 3 = highlight + msg + join/part */ int num_displayed; /* number of windows displaying buf. */ + int print_hooks_enabled; /* 1 if print hooks are enabled */ /* close callback */ int (*close_callback)(void *data, /* called when buffer is closed */ diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 5b6a1fac2..409f14020 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -1156,7 +1156,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date, gui_chat_line_add (buffer, (display_time) ? date : 0, (display_time) ? date_printed : 0, tags, pos_prefix, ptr_msg); - if (buffer->last_line) + if (buffer->last_line && buffer->print_hooks_enabled) { hook_print_exec (buffer, buffer->last_line); } diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 1e03cb35f..96be9608c 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -755,6 +755,7 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) struct tm tm_line; int num_lines; + weechat_buffer_set (buffer, "print_hooks_enabled", "0"); num_lines = 0; last_lines = logger_tail_file (filename, lines); ptr_lines = last_lines; @@ -802,6 +803,7 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) num_lines); weechat_buffer_set (buffer, "unread", ""); } + weechat_buffer_set (buffer, "print_hooks_enabled", "1"); } /* |