diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/includes/autogen_api_hdata.de.adoc | 4 | ||||
-rw-r--r-- | doc/de/weechat_user.de.adoc | 3 | ||||
-rw-r--r-- | doc/en/includes/autogen_api_hdata.en.adoc | 4 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 4 | ||||
-rw-r--r-- | doc/en/weechat_user.en.adoc | 2 | ||||
-rw-r--r-- | doc/fr/includes/autogen_api_hdata.fr.adoc | 4 | ||||
-rw-r--r-- | doc/fr/weechat_user.fr.adoc | 2 | ||||
-rw-r--r-- | doc/it/includes/autogen_api_hdata.it.adoc | 4 | ||||
-rw-r--r-- | doc/it/weechat_user.it.adoc | 3 | ||||
-rw-r--r-- | doc/ja/includes/autogen_api_hdata.ja.adoc | 4 | ||||
-rw-r--r-- | doc/ja/weechat_user.ja.adoc | 3 | ||||
-rw-r--r-- | doc/pl/includes/autogen_api_hdata.pl.adoc | 4 | ||||
-rw-r--r-- | doc/pl/weechat_user.pl.adoc | 3 | ||||
-rw-r--r-- | src/gui/gui-bar-item.c | 91 | ||||
-rw-r--r-- | src/gui/gui-bar-item.h | 2 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 34 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 4 | ||||
-rw-r--r-- | src/gui/gui-nicklist.c | 24 |
19 files changed, 171 insertions, 29 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 45cc1798a..a96e4c331 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] New features:: + * core: count only visible nicks in bar item "buffer_nicklist_count", add bar items "buffer_nicklist_count_groups" and "buffer_nicklist_count_all" (issue #1506) * core: set default size for input bar to 0 (automatic) (issue #1498) * core: add default key kbd:[Alt+Enter] to insert a newline (issue #1498) * core: add flag "input_multiline" in buffer (issue #984, issue #1063) diff --git a/doc/de/includes/autogen_api_hdata.de.adoc b/doc/de/includes/autogen_api_hdata.de.adoc index 56d6819f4..2b41faf3b 100644 --- a/doc/de/includes/autogen_api_hdata.de.adoc +++ b/doc/de/includes/autogen_api_hdata.de.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index 73f6ece89..a0cc3ae0a 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -686,7 +686,8 @@ Die _status_-Bar besitzt als Standardeinträge: | buffer_number | `2` | Aktuelle Nummer des Buffers. | buffer_name | `#test` | Name des aktuellen Buffers. | buffer_modes | `+n` | IRC Channel-Modi. -| buffer_nicklist_count | `{4}` | Anzahl der Nicks in Benutzerliste. +// TRANSLATION MISSING +| buffer_nicklist_count | `{4}` | Number of nicks displayed in nicklist. | buffer_zoom | ! | `!` bedeutet, dass ein zusammengefügter Buffer gezoomed (nur dieser Buffer wird angezeigt) wird. | buffer_filter | `+*+` | Filteranzeige: `+*+` bedeutet das Zeilen gefiltert (unterdrückt) wurden. Ein leerer Eintrag zeigt an dass alle Zeilen dargestellt werden. | scroll | `-MORE(50)-` | Scroll Indikator, zeigt an wie viele Zeilen unterhalb der zur Zeit dargestellten Zeile vorhanden sind. diff --git a/doc/en/includes/autogen_api_hdata.en.adoc b/doc/en/includes/autogen_api_hdata.en.adoc index dbfcd6ae6..d25f819fd 100644 --- a/doc/en/includes/autogen_api_hdata.en.adoc +++ b/doc/en/includes/autogen_api_hdata.en.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 75dd458d3..297d6228b 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -12775,9 +12775,11 @@ Arguments: ** _nicklist_max_length_: max length for a nick ** _nicklist_display_groups_: 1 if groups are displayed, otherwise 0 ** _nicklist_count_: number of nicks and groups in nicklist +** _nicklist_visible_count_: number of nicks/groups displayed ** _nicklist_groups_count_: number of groups in nicklist +** _nicklist_visible_groups_count_: number of groups displayed ** _nicklist_nicks_count_: number of nicks in nicklist -** _nicklist_visible_count_: number of nicks/groups displayed +** _nicklist_visible_nicks_count_: number of nicks displayed ** _input_: 1 if input is enabled, otherwise 0 ** _input_get_unknown_commands_: 1 if unknown commands are sent to input callback, otherwise 0 diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index 8d21cc8b0..14ed5b3ce 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -680,7 +680,7 @@ Bar _status_ has following default items: | buffer_number | `2` | Current buffer number. | buffer_name | `#test` | Current buffer name. | buffer_modes | `+n` | IRC channel modes. -| buffer_nicklist_count | `{4}` | Number of nicks in nicklist. +| buffer_nicklist_count | `{4}` | Number of nicks displayed in nicklist. | buffer_zoom | ! | `!` means the merged buffer is zoomed (only this one is displayed), empty value means all merged buffers are displayed. | buffer_filter | `+*+` | Filtering indicator: `+*+` means some lines are filtered (hidden), empty value means all lines are displayed. | scroll | `-MORE(50)-` | Scroll indicator, with number of lines below last line displayed. diff --git a/doc/fr/includes/autogen_api_hdata.fr.adoc b/doc/fr/includes/autogen_api_hdata.fr.adoc index ebbc7f723..dcb18086a 100644 --- a/doc/fr/includes/autogen_api_hdata.fr.adoc +++ b/doc/fr/includes/autogen_api_hdata.fr.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index 381646751..24a9cb43b 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -697,7 +697,7 @@ La barre _status_ contient les objets (items) suivants par défaut : | buffer_number | `2` | Numéro du tampon courant. | buffer_name | `#test` | Nom du tampon courant. | buffer_modes | `+n` | Modes du canal IRC. -| buffer_nicklist_count | `{4}` | Nombre de pseudos dans la liste des pseudos. +| buffer_nicklist_count | `{4}` | Nombre de pseudos affichés dans la liste des pseudos. | buffer_zoom | ! | `!` signifie que le tampon mélangé est zoomé, une valeur vide signifie que tous les tampons mélangés sont affichés. | buffer_filter | `+*+` | Indicateur de filtrage : `+*+` signifie que des lignes sont filtrées (cachées), une valeur vide signifie que toutes les lignes sont affichées. | scroll | `-PLUS(50)-` | Indicateur de scroll, avec le nombre de lignes sous la dernière ligne affichée. diff --git a/doc/it/includes/autogen_api_hdata.it.adoc b/doc/it/includes/autogen_api_hdata.it.adoc index ac0d63b11..8938c0fc6 100644 --- a/doc/it/includes/autogen_api_hdata.it.adoc +++ b/doc/it/includes/autogen_api_hdata.it.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index bab4edb60..f08db20a9 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -736,7 +736,8 @@ La barra _status_ ha i seguenti elementi predefiniti: | buffer_number | `2` | Numero del buffer corrente. | buffer_name | `#test` | Nome del buffer attivo. | buffer_modes | `+n` | Modalità canale IRC. -| buffer_nicklist_count | `{4}` | Numero di nick nella lista nick. +// TRANSLATION MISSING +| buffer_nicklist_count | `{4}` | Number of nicks displayed in nicklist. // TRANSLATION MISSING | buffer_zoom | ! | `!` means the merged buffer is zoomed (only this one is displayed), empty value means all merged buffers are displayed. | buffer_filter | `+*+` | Indicatore filtraggio: `+*+` significa che alcune righe sono filtrate (nascoste), valori vuoti indicano che tutte le righe sono visualizzate. diff --git a/doc/ja/includes/autogen_api_hdata.ja.adoc b/doc/ja/includes/autogen_api_hdata.ja.adoc index e1c0d5d52..8423f86e1 100644 --- a/doc/ja/includes/autogen_api_hdata.ja.adoc +++ b/doc/ja/includes/autogen_api_hdata.ja.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index 42e06587f..2e2f547bb 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -689,7 +689,8 @@ WeeChat を起動した端末の例: | buffer_number | `2` | 現在のバッファの番号 | buffer_name | `#test` | 現在のバッファの名前 | buffer_modes | `+n` | IRC チャンネルモード -| buffer_nicklist_count | `{4}` | ニックネームリスト中のニックネームの数 +// TRANSLATION MISSING +| buffer_nicklist_count | `{4}` | Number of nicks displayed in nicklist. | buffer_zoom | ! | `!` はマージされたバッファがズームされている状態 (ズームされたものだけを表示する状態) を示します、空の場合はすべてのマージされたバッファが表示されていることを示します | buffer_filter | `+*+` | フィルタ表示: `+*+` の場合いくつかの行がフィルタされ (隠され) ます、空の場合すべての行が表示されます。 | scroll | `-MORE(50)-` | スクロール表示、最後の行が表示されてから追加された行数を含む。 diff --git a/doc/pl/includes/autogen_api_hdata.pl.adoc b/doc/pl/includes/autogen_api_hdata.pl.adoc index 34ac73db5..616578373 100644 --- a/doc/pl/includes/autogen_api_hdata.pl.adoc +++ b/doc/pl/includes/autogen_api_hdata.pl.adoc @@ -577,9 +577,11 @@ _nicklist_root_ (pointer, hdata: "nick_group") + _nicklist_max_length_ (integer) + _nicklist_display_groups_ (integer) + _nicklist_count_ (integer) + +_nicklist_visible_count_ (integer) + _nicklist_groups_count_ (integer) + +_nicklist_groups_visible_count_ (integer) + _nicklist_nicks_count_ (integer) + -_nicklist_visible_count_ (integer) + +_nicklist_nicks_visible_count_ (integer) + _nickcmp_callback_ (pointer) + _nickcmp_callback_pointer_ (pointer) + _nickcmp_callback_data_ (pointer) + diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index 3f37e97b6..013de7206 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -686,7 +686,8 @@ Pasek _status_ posiada następujące domyślne elementy: | buffer_number | `2` | Numer obecnego buforu. | buffer_name | `#test` | Nazwa obecnego buforu. | buffer_modes | `+n` | Tryby kanału IRC. -| buffer_nicklist_count | `{4}` | Ilość nicków na liście nicków. +// TRANSLATION MISSING +| buffer_nicklist_count | `{4}` | Number of nicks displayed in nicklist. | buffer_zoom | ! | `!` oznacza, że połączony bufor jest przybliżony (tylko ten jest wyświetlany), pusta wartość oznacza, że wszystkie połączone bufory są wyświetlane. | buffer_filter | `+*+` | Wskaźnik filtrowania: `+*+` oznacza, że niektóre linie zostały odfiltrowywane (ukryte), pusta wartość oznacza, że wszystkie linie są wyświetlane. | scroll | `-Więcej(50)-` | Wskaźnik przewijania, z numerem linii poniżej ostatniej wyświetlanej. diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index b2382a567..7974f1910 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -61,7 +61,8 @@ char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] = { "input_paste", "input_prompt", "input_search", "input_text", "time", "buffer_count", "buffer_last_number", "buffer_plugin", "buffer_number", "buffer_name", "buffer_short_name", "buffer_modes", "buffer_filter", - "buffer_zoom", "buffer_nicklist_count", "scroll", "hotlist", "completion", + "buffer_zoom", "buffer_nicklist_count", "buffer_nicklist_count_groups", + "buffer_nicklist_count_all", "scroll", "hotlist", "completion", "buffer_title", "buffer_nicklist", "window_number", "mouse_status", "away" }; char *gui_bar_items_default_for_bars[][2] = @@ -1246,7 +1247,7 @@ gui_bar_item_buffer_filter_cb (const void *pointer, void *data, } /* - * Bar item with number of nicks in buffer nicklist. + * Bar item with number of visible nicks in buffer nicklist. */ char * @@ -1271,6 +1272,68 @@ gui_bar_item_buffer_nicklist_count_cb (const void *pointer, void *data, snprintf (str_count, sizeof (str_count), "%s%d", gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_nicklist_count))), + buffer->nicklist_nicks_visible_count); + + return strdup (str_count); +} + +/* + * Bar item with number of visible groups in buffer nicklist. + */ + +char * +gui_bar_item_buffer_nicklist_count_groups_cb (const void *pointer, void *data, + struct t_gui_bar_item *item, + struct t_gui_window *window, + struct t_gui_buffer *buffer, + struct t_hashtable *extra_info) +{ + char str_count[64]; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) item; + (void) window; + (void) extra_info; + + if (!buffer || !buffer->nicklist) + return NULL; + + snprintf (str_count, sizeof (str_count), + "%s%d", + gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_nicklist_count))), + buffer->nicklist_groups_visible_count); + + return strdup (str_count); +} + +/* + * Bar item with number of visible groups and nicks in buffer nicklist. + */ + +char * +gui_bar_item_buffer_nicklist_count_all_cb (const void *pointer, void *data, + struct t_gui_bar_item *item, + struct t_gui_window *window, + struct t_gui_buffer *buffer, + struct t_hashtable *extra_info) +{ + char str_count[64]; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) item; + (void) window; + (void) extra_info; + + if (!buffer || !buffer->nicklist) + return NULL; + + snprintf (str_count, sizeof (str_count), + "%s%d", + gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_nicklist_count))), buffer->nicklist_visible_count); return strdup (str_count); @@ -2258,7 +2321,7 @@ gui_bar_item_init () gui_bar_item_hook_signal ("buffer_switch", gui_bar_item_names[GUI_BAR_ITEM_BUFFER_ZOOM]); - /* buffer nicklist count */ + /* buffer nicklist count: nicks displayed */ gui_bar_item_new (NULL, gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT], &gui_bar_item_buffer_nicklist_count_cb, NULL, NULL); @@ -2269,6 +2332,28 @@ gui_bar_item_init () gui_bar_item_hook_signal ("nicklist_*", gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT]); + /* buffer nicklist count: groups displayed */ + gui_bar_item_new (NULL, + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_GROUPS], + &gui_bar_item_buffer_nicklist_count_groups_cb, NULL, NULL); + gui_bar_item_hook_signal ("window_switch", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_GROUPS]); + gui_bar_item_hook_signal ("buffer_switch", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_GROUPS]); + gui_bar_item_hook_signal ("nicklist_*", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_GROUPS]); + + /* buffer nicklist count: groups + nicks displayed */ + gui_bar_item_new (NULL, + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_ALL], + &gui_bar_item_buffer_nicklist_count_all_cb, NULL, NULL); + gui_bar_item_hook_signal ("window_switch", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_ALL]); + gui_bar_item_hook_signal ("buffer_switch", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_ALL]); + gui_bar_item_hook_signal ("nicklist_*", + gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_ALL]); + /* scroll indicator */ gui_bar_item_new (NULL, gui_bar_item_names[GUI_BAR_ITEM_SCROLL], diff --git a/src/gui/gui-bar-item.h b/src/gui/gui-bar-item.h index 170e737b5..fae7b439b 100644 --- a/src/gui/gui-bar-item.h +++ b/src/gui/gui-bar-item.h @@ -37,6 +37,8 @@ enum t_gui_bar_item_weechat GUI_BAR_ITEM_BUFFER_FILTER, GUI_BAR_ITEM_BUFFER_ZOOM, GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT, + GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_GROUPS, + GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT_ALL, GUI_BAR_ITEM_SCROLL, GUI_BAR_ITEM_HOTLIST, GUI_BAR_ITEM_COMPLETION, diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index b84dcea85..a35cc620d 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -91,8 +91,10 @@ char *gui_buffer_properties_get_integer[] = "day_change", "clear", "filter", "closing", "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", + "nicklist_count", "nicklist_visible_count", + "nicklist_groups_count", "nicklist_groups_visible_count", + "nicklist_nicks_count", "nicklist_nicks_visible_count", + "input", "input_get_unknown_commands", "input_get_empty", "input_multiline", "input_size", "input_length", "input_pos", "input_1st_display", "num_history", "text_search", "text_search_exact", "text_search_regex", "text_search_where", @@ -728,9 +730,11 @@ gui_buffer_new (struct t_weechat_plugin *plugin, new_buffer->nicklist_max_length = 0; new_buffer->nicklist_display_groups = 1; new_buffer->nicklist_count = 0; + new_buffer->nicklist_visible_count = 0; new_buffer->nicklist_groups_count = 0; + new_buffer->nicklist_groups_visible_count = 0; new_buffer->nicklist_nicks_count = 0; - new_buffer->nicklist_visible_count = 0; + new_buffer->nicklist_nicks_visible_count = 0; new_buffer->nickcmp_callback = NULL; new_buffer->nickcmp_callback_pointer = NULL; new_buffer->nickcmp_callback_data = NULL; @@ -1164,12 +1168,16 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property) return buffer->nicklist_display_groups; else if (string_strcasecmp (property, "nicklist_count") == 0) return buffer->nicklist_count; + else if (string_strcasecmp (property, "nicklist_visible_count") == 0) + return buffer->nicklist_visible_count; else if (string_strcasecmp (property, "nicklist_groups_count") == 0) return buffer->nicklist_groups_count; + else if (string_strcasecmp (property, "nicklist_groups_visible_count") == 0) + return buffer->nicklist_groups_visible_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, "nicklist_nicks_visible_count") == 0) + return buffer->nicklist_nicks_visible_count; else if (string_strcasecmp (property, "input") == 0) return buffer->input; else if (string_strcasecmp (property, "input_get_unknown_commands") == 0) @@ -1478,6 +1486,8 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer, buffer->nicklist_display_groups = (display_groups) ? 1 : 0; buffer->nicklist_visible_count = 0; + buffer->nicklist_groups_visible_count = 0; + buffer->nicklist_nicks_visible_count = 0; gui_nicklist_compute_visible_count (buffer, buffer->nicklist_root); gui_window_ask_refresh (1); } @@ -4308,9 +4318,11 @@ gui_buffer_hdata_buffer_cb (const void *pointer, void *data, 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_visible_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_groups_visible_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, nicklist_nicks_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_pointer, POINTER, 0, NULL, NULL); HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, 0, NULL, NULL); @@ -4507,11 +4519,15 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_integer (ptr_item, "nicklist_count", buffer->nicklist_count)) return 0; + if (!infolist_new_var_integer (ptr_item, "nicklist_visible_count", buffer->nicklist_visible_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_groups_visible_count", buffer->nicklist_groups_visible_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)) + if (!infolist_new_var_integer (ptr_item, "nicklist_nicks_visible_count", buffer->nicklist_nicks_visible_count)) return 0; if (!infolist_new_var_string (ptr_item, "title", buffer->title)) return 0; @@ -4726,9 +4742,11 @@ gui_buffer_print_log () 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_visible_count. : %d", ptr_buffer->nicklist_visible_count); log_printf (" nicklist_groups_count . : %d", ptr_buffer->nicklist_groups_count); + log_printf (" nicklist_groups_vis_cnt : %d", ptr_buffer->nicklist_groups_visible_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 (" nicklist_nicks_vis_cnt. : %d", ptr_buffer->nicklist_nicks_visible_count); log_printf (" nickcmp_callback. . . . : 0x%lx", ptr_buffer->nickcmp_callback); log_printf (" nickcmp_callback_pointer: 0x%lx", ptr_buffer->nickcmp_callback_pointer); 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 bc7dfec7f..a7011d47c 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -133,9 +133,11 @@ struct t_gui_buffer int nicklist_max_length; /* max length for a nick */ int nicklist_display_groups; /* display groups ? */ int nicklist_count; /* number of nicks/groups */ + int nicklist_visible_count; /* number of nicks/groups displayed */ int nicklist_groups_count; /* number of groups */ + int nicklist_groups_visible_count; /* number of groups displayed */ int nicklist_nicks_count; /* number of nicks */ - int nicklist_visible_count; /* number of nicks/groups to display */ + int nicklist_nicks_visible_count; /* number of nicks displayed */ int (*nickcmp_callback)(const void *pointer, /* called to compare nicks */ void *data, /* (search in nicklist) */ struct t_gui_buffer *buffer, diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index c4ee290d4..9b6c03da1 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -294,7 +294,10 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer, } if (buffer->nicklist_display_groups && visible) + { buffer->nicklist_visible_count++; + buffer->nicklist_groups_visible_count++; + } gui_nicklist_send_signal ("nicklist_group_added", buffer, name); gui_nicklist_send_hsignal ("nicklist_group_added", buffer, new_group, NULL); @@ -455,7 +458,10 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer, buffer->nicklist_nicks_count++; if (visible) + { buffer->nicklist_visible_count++; + buffer->nicklist_nicks_visible_count++; + } if (CONFIG_BOOLEAN(config_look_color_nick_offline)) gui_buffer_ask_chat_refresh (buffer, 1); @@ -511,6 +517,8 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer, { if (buffer->nicklist_visible_count > 0) buffer->nicklist_visible_count--; + if (buffer->nicklist_nicks_visible_count > 0) + buffer->nicklist_nicks_visible_count--; } free (nick); @@ -580,11 +588,12 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer, if (group->color) string_shared_free (group->color); - if (group->visible) + if (buffer->nicklist_display_groups && group->visible) { - if (buffer->nicklist_display_groups - && (buffer->nicklist_visible_count > 0)) + if (buffer->nicklist_visible_count > 0) buffer->nicklist_visible_count--; + if (buffer->nicklist_groups_visible_count > 0) + buffer->nicklist_groups_visible_count--; } free (group); @@ -795,12 +804,19 @@ gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer, /* count current group */ if (buffer->nicklist_display_groups && group->visible) + { buffer->nicklist_visible_count++; + buffer->nicklist_groups_visible_count++; + } /* count nicks in group */ for (ptr_nick = group->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - buffer->nicklist_visible_count++; + if (ptr_nick->visible) + { + buffer->nicklist_visible_count++; + buffer->nicklist_nicks_visible_count++; + } } } |