aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorDaniel <quite@hack.org>2015-07-08 13:11:56 +0200
committerDaniel <quite@hack.org>2015-07-08 13:11:56 +0200
commit806afcc014ba272b32f63e7d28edaf25cacd279e (patch)
tree0ca7ed718b9b8761e3a8044e04f17d1d651f87fb /src/ui
parent5e324e407fda7d616c8b6056495de9db1d5a49e0 (diff)
downloadprofani-tty-806afcc014ba272b32f63e7d28edaf25cacd279e.tar.gz
Allow hiding of empty presence groups: /roster {show,hide} empty (default is show)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c5
-rw-r--r--src/ui/rosterwin.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 8bf873a5..ceb02e08 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1039,6 +1039,11 @@ cons_roster_setting(void)
else
cons_show("Roster resource (/roster) : hide");
+ if (prefs_get_boolean(PREF_ROSTER_EMPTY))
+ cons_show("Roster empty (/roster) : show");
+ else
+ cons_show("Roster empty (/roster) : hide");
+
char *by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by);
prefs_free_string(by);
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index db9a4af6..e48be866 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -84,11 +84,15 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
static void
_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char * const presence, char *title)
{
- wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
- win_printline_nowrap(layout->subwin, title);
- wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
-
GSList *contacts = roster_get_contacts_by_presence(presence);
+
+ // if this group has contacts, or if we want to show empty groups
+ if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
+ wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
+ win_printline_nowrap(layout->subwin, title);
+ wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
+ }
+
if (contacts) {
GSList *curr_contact = contacts;
while (curr_contact) {