From 806afcc014ba272b32f63e7d28edaf25cacd279e Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 8 Jul 2015 13:11:56 +0200 Subject: Allow hiding of empty presence groups: /roster {show,hide} empty (default is show) --- src/command/command.c | 3 +++ src/command/commands.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src/command') diff --git a/src/command/command.c b/src/command/command.c index 105e41e5..8ed3a3b6 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -196,9 +196,11 @@ static struct cmd_t command_defs[] = "show : Show the roster panel.", "show offline : Show offline contacts in the roster panel.", "show resource : Show contact's connected resources in the roster panel.", + "show empty : When grouping by presence, show empty presence groups", "hide : Hide the roster panel.", "hide offline : Hide offline contacts in the roster panel.", "hide resource : Hide contact's connected resources in the roster panel.", + "hide empty : When grouping by presence, hide empty presence groups", "by group : Group contacts in the roster panel by roster group.", "by presence : Group contacts in the roster panel by presence.", "by none : No grouping in the roster panel.", @@ -1439,6 +1441,7 @@ cmd_init(void) roster_option_ac = autocomplete_new(); autocomplete_add(roster_option_ac, "offline"); autocomplete_add(roster_option_ac, "resource"); + autocomplete_add(roster_option_ac, "empty"); roster_by_ac = autocomplete_new(); autocomplete_add(roster_by_ac, "group"); diff --git a/src/command/commands.c b/src/command/commands.c index 7f13d5f5..8c071048 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1578,6 +1578,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help) rosterwin_roster(); } return TRUE; + } else if (g_strcmp0(args[1], "empty") == 0) { + cons_show("Roster empty enabled"); + prefs_set_boolean(PREF_ROSTER_EMPTY, TRUE); + if (conn_status == JABBER_CONNECTED) { + rosterwin_roster(); + } + return TRUE; } else { cons_show("Usage: %s", help.usage); return TRUE; @@ -1604,6 +1611,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help) rosterwin_roster(); } return TRUE; + } else if (g_strcmp0(args[1], "empty") == 0) { + cons_show("Roster empty disabled"); + prefs_set_boolean(PREF_ROSTER_EMPTY, FALSE); + if (conn_status == JABBER_CONNECTED) { + rosterwin_roster(); + } + return TRUE; } else { cons_show("Usage: %s", help.usage); return TRUE; -- cgit