about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-20 01:48:41 +0000
committerJames Booth <boothj5@gmail.com>2016-01-20 01:48:41 +0000
commit5bccee93cc0c8c2426d5f5acc462dca15467cb08 (patch)
treee96737b02a68115dfb15ca588772241d7cc7de99 /src/ui
parent10507b687b21a6827f0a60d6c92a778bdc91070b (diff)
downloadprofani-tty-5bccee93cc0c8c2426d5f5acc462dca15467cb08.tar.gz
Added /roster show|hide contacts
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c5
-rw-r--r--src/ui/rosterwin.c112
2 files changed, 62 insertions, 55 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 76adc58a..39de1ae7 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1324,6 +1324,11 @@ cons_roster_setting(void)
     else
         cons_show("Roster priority (/roster)        : hide");
 
+    if (prefs_get_boolean(PREF_ROSTER_CONTACTS))
+        cons_show("Roster contacts (/roster)        : show");
+    else
+        cons_show("Roster contacts (/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 2771420b..86472d48 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -614,68 +614,70 @@ rosterwin_roster(void)
         newline = TRUE;
     }
 
-    char *by = prefs_get_string(PREF_ROSTER_BY);
-    if (g_strcmp0(by, "presence") == 0) {
-        _rosterwin_contacts_by_presence(layout, "chat", "Available for chat", newline);
-        _rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
-        _rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
-        _rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
-        _rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
-        if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
-            _rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
-        }
-    } else if (g_strcmp0(by, "group") == 0) {
-        GSList *groups = roster_get_groups();
-        GSList *curr_group = groups;
-        while (curr_group) {
-            _rosterwin_contacts_by_group(layout, curr_group->data, newline);
-            newline = TRUE;
-            curr_group = g_slist_next(curr_group);
-        }
-        g_slist_free_full(groups, free);
-        _rosterwin_contacts_by_no_group(layout, newline);
-    } else {
-        GSList *contacts = NULL;
-
-        char *order = prefs_get_string(PREF_ROSTER_ORDER);
-        gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
-        if (g_strcmp0(order, "presence") == 0) {
-            contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, offline);
+    if (prefs_get_boolean(PREF_ROSTER_CONTACTS)) {
+        char *by = prefs_get_string(PREF_ROSTER_BY);
+        if (g_strcmp0(by, "presence") == 0) {
+            _rosterwin_contacts_by_presence(layout, "chat", "Available for chat", newline);
+            _rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
+            _rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
+            _rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
+            _rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
+            if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
+                _rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
+            }
+        } else if (g_strcmp0(by, "group") == 0) {
+            GSList *groups = roster_get_groups();
+            GSList *curr_group = groups;
+            while (curr_group) {
+                _rosterwin_contacts_by_group(layout, curr_group->data, newline);
+                newline = TRUE;
+                curr_group = g_slist_next(curr_group);
+            }
+            g_slist_free_full(groups, free);
+            _rosterwin_contacts_by_no_group(layout, newline);
         } else {
-            contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
-        }
-        prefs_free_string(order);
+            GSList *contacts = NULL;
 
-        wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
-        GString *title = g_string_new(" ");
-        char ch = prefs_get_roster_header_char();
-        if (ch) {
-            g_string_append_printf(title, "%c", ch);
-        }
-        if (newline) {
-            win_sub_newline_lazy(layout->subwin);
-        }
+            char *order = prefs_get_string(PREF_ROSTER_ORDER);
+            gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
+            if (g_strcmp0(order, "presence") == 0) {
+                contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, offline);
+            } else {
+                contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
+            }
+            prefs_free_string(order);
 
-        g_string_append(title, "Roster");
-        if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
-            g_string_append_printf(title, " (%d)", g_slist_length(contacts));
-        }
-        gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
-        win_sub_print(layout->subwin, title->str, FALSE, wrap, 1);
-        g_string_free(title, TRUE);
-        wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
+            wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
+            GString *title = g_string_new(" ");
+            char ch = prefs_get_roster_header_char();
+            if (ch) {
+                g_string_append_printf(title, "%c", ch);
+            }
+            if (newline) {
+                win_sub_newline_lazy(layout->subwin);
+            }
 
-        if (contacts) {
-            GSList *curr_contact = contacts;
-            while (curr_contact) {
-                PContact contact = curr_contact->data;
-                _rosterwin_contact(layout, contact);
-                curr_contact = g_slist_next(curr_contact);
+            g_string_append(title, "Roster");
+            if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
+                g_string_append_printf(title, " (%d)", g_slist_length(contacts));
             }
+            gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
+            win_sub_print(layout->subwin, title->str, FALSE, wrap, 1);
+            g_string_free(title, TRUE);
+            wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
+
+            if (contacts) {
+                GSList *curr_contact = contacts;
+                while (curr_contact) {
+                    PContact contact = curr_contact->data;
+                    _rosterwin_contact(layout, contact);
+                    curr_contact = g_slist_next(curr_contact);
+                }
+            }
+            g_slist_free(contacts);
         }
-        g_slist_free(contacts);
+        prefs_free_string(by);
     }
-    prefs_free_string(by);
 
     if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "last") == 0)) {
         _rosterwin_rooms(layout, TRUE);