diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-03-03 11:30:58 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-03-03 11:30:58 +0100 |
commit | 8b925baa3cff083653b38603cf19090748d9a82e (patch) | |
tree | c86b07c20f54a0808fdd580879207b2c5020a776 /src | |
parent | 844ba9e1c07d0f17c0081d666591c5f2758078bf (diff) | |
download | weechat-8b925baa3cff083653b38603cf19090748d9a82e.zip |
core: add count for groups, nicks, and total in nicklist
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-buffer.c | 22 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 3 | ||||
-rw-r--r-- | src/gui/gui-nicklist.c | 11 |
3 files changed, 36 insertions, 0 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index e5ec36266..0dbeb0111 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -78,6 +78,7 @@ char *gui_buffer_properties_get_integer[] = "num_displayed", "active", "print_hooks_enabled", "lines_hidden", "prefix_max_length", "time_for_each_line", "nicklist", "nicklist_case_sensitive", "nicklist_max_length", "nicklist_display_groups", + "nicklist_count", "nicklist_groups_count", "nicklist_nicks_count", "nicklist_visible_count", "input", "input_get_unknown_commands", "input_size", "input_length", "input_pos", "input_1st_display", "num_history", "text_search", "text_search_exact", "text_search_found", @@ -494,6 +495,9 @@ gui_buffer_new (struct t_weechat_plugin *plugin, new_buffer->nicklist_root = NULL; new_buffer->nicklist_max_length = 0; new_buffer->nicklist_display_groups = 1; + new_buffer->nicklist_count = 0; + new_buffer->nicklist_groups_count = 0; + new_buffer->nicklist_nicks_count = 0; new_buffer->nicklist_visible_count = 0; new_buffer->nickcmp_callback = NULL; new_buffer->nickcmp_callback_data = NULL; @@ -868,6 +872,12 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property) return buffer->nicklist_max_length; else if (string_strcasecmp (property, "nicklist_display_groups") == 0) return buffer->nicklist_display_groups; + else if (string_strcasecmp (property, "nicklist_count") == 0) + return buffer->nicklist_count; + else if (string_strcasecmp (property, "nicklist_groups_count") == 0) + return buffer->nicklist_groups_count; + else if (string_strcasecmp (property, "nicklist_nicks_count") == 0) + return buffer->nicklist_nicks_count; else if (string_strcasecmp (property, "nicklist_visible_count") == 0) return buffer->nicklist_visible_count; else if (string_strcasecmp (property, "input") == 0) @@ -3185,6 +3195,9 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name) HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER, 0, NULL, "nick_group"); HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, 0, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_count, INTEGER, 0, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_groups_count, INTEGER, 0, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_nicks_count, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, 0, NULL, NULL); HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, 0, NULL, NULL); @@ -3351,6 +3364,12 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_integer (ptr_item, "nicklist_max_length", buffer->nicklist_max_length)) return 0; + if (!infolist_new_var_integer (ptr_item, "nicklist_count", buffer->nicklist_count)) + return 0; + if (!infolist_new_var_integer (ptr_item, "nicklist_groups_count", buffer->nicklist_groups_count)) + return 0; + if (!infolist_new_var_integer (ptr_item, "nicklist_nicks_count", buffer->nicklist_nicks_count)) + return 0; if (!infolist_new_var_integer (ptr_item, "nicklist_visible_count", buffer->nicklist_visible_count)) return 0; if (!infolist_new_var_string (ptr_item, "title", buffer->title)) @@ -3542,6 +3561,9 @@ gui_buffer_print_log () log_printf (" nicklist_root . . . . . : 0x%lx", ptr_buffer->nicklist_root); log_printf (" nicklist_max_length . . : %d", ptr_buffer->nicklist_max_length); log_printf (" nicklist_display_groups : %d", ptr_buffer->nicklist_display_groups); + log_printf (" nicklist_count. . . . . : %d", ptr_buffer->nicklist_count); + log_printf (" nicklist_groups_count . : %d", ptr_buffer->nicklist_groups_count); + log_printf (" nicklist_nicks_count. . : %d", ptr_buffer->nicklist_nicks_count); log_printf (" nicklist_visible_count. : %d", ptr_buffer->nicklist_visible_count); log_printf (" nickcmp_callback. . . . : 0x%lx", ptr_buffer->nickcmp_callback); log_printf (" nickcmp_callback_data . : 0x%lx", ptr_buffer->nickcmp_callback_data); diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 9cc93de7c..e1704cf9f 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -113,6 +113,9 @@ struct t_gui_buffer struct t_gui_nick_group *nicklist_root; /* pointer to groups root */ int nicklist_max_length; /* max length for a nick */ int nicklist_display_groups; /* display groups ? */ + int nicklist_count; /* number of nicks/groups */ + int nicklist_groups_count; /* number of groups */ + int nicklist_nicks_count; /* number of nicks */ int nicklist_visible_count; /* number of nicks/groups to display */ int (*nickcmp_callback)(void *data, /* called to compare nicks (search */ struct t_gui_buffer *buffer, /* in nicklist) */ diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index be6fdb484..d03fe3175 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -247,6 +247,8 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer, gui_nicklist_insert_group_sorted (&(new_group->parent->children), &(new_group->parent->last_child), new_group); + buffer->nicklist_count++; + buffer->nicklist_groups_count++; } else { @@ -409,6 +411,9 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer, gui_nicklist_insert_nick_sorted (new_nick->group, new_nick); + buffer->nicklist_count++; + buffer->nicklist_nicks_count++; + if (visible) buffer->nicklist_visible_count++; @@ -455,6 +460,9 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer, if (nick->prefix_color) free (nick->prefix_color); + buffer->nicklist_count--; + buffer->nicklist_nicks_count--; + if (nick->visible) { if (buffer->nicklist_visible_count > 0) @@ -510,6 +518,9 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer, (group->parent)->children = group->next_group; if ((group->parent)->last_child == group) (group->parent)->last_child = group->prev_group; + + buffer->nicklist_count--; + buffer->nicklist_groups_count--; } else { |