about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-11 00:00:10 +0000
committerJames Booth <boothj5@gmail.com>2014-11-11 00:00:10 +0000
commiteace543da5620ca4c1d94d74ddd5342be4c66f47 (patch)
treef1bdbe539ce9606554f8a648f358f41c75e45522 /src/ui
parentf715c0580c904caababf980e0fef72ae28944424 (diff)
downloadprofani-tty-eace543da5620ca4c1d94d74ddd5342be4c66f47.tar.gz
Added /roster show|hide resource
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c10
-rw-r--r--src/ui/core.c56
2 files changed, 39 insertions, 27 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 831b1b7d..d4f6bcc9 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -948,6 +948,16 @@ _cons_roster_setting(void)
         cons_show("Roster (/roster)              : show");
     else
         cons_show("Roster (/roster)              : hide");
+
+    if (prefs_get_boolean(PREF_ROSTER_OFFLINE))
+        cons_show("Roster offline (/roster)      : show");
+    else
+        cons_show("Roster offline (/roster)      : hide");
+
+    if (prefs_get_boolean(PREF_ROSTER_RESOURCE))
+        cons_show("Roster resource (/roster)     : show");
+    else
+        cons_show("Roster resource (/roster)     : hide");
 }
 
 static void
diff --git a/src/ui/core.c b/src/ui/core.c
index e2beae04..c5e3711f 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -2835,34 +2835,36 @@ _ui_roster(void)
 
                         wattroff(window->subwin, presence_colour);
 
-                        GList *resources = p_contact_get_available_resources(contact);
-                        GList *ordered_resources = NULL;
-
-                        // sort in order of availabiltiy
-                        while (resources != NULL) {
-                            Resource *resource = resources->data;
-                            ordered_resources = g_list_insert_sorted(ordered_resources, resource, (GCompareFunc)resource_compare_availability);
-                            resources = g_list_next(resources);
+                        if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
+                            GList *resources = p_contact_get_available_resources(contact);
+                            GList *ordered_resources = NULL;
+
+                            // sort in order of availabiltiy
+                            while (resources != NULL) {
+                                Resource *resource = resources->data;
+                                ordered_resources = g_list_insert_sorted(ordered_resources, resource, (GCompareFunc)resource_compare_availability);
+                                resources = g_list_next(resources);
+                            }
+
+                            g_list_free(resources);
+
+                            while (ordered_resources) {
+                                Resource *resource = ordered_resources->data;
+                                const char *resource_presence = string_from_resource_presence(resource->presence);
+                                int resource_presence_colour = win_presence_colour(resource_presence);
+                                wattron(window->subwin, resource_presence_colour);
+
+                                GString *msg = g_string_new("     ");
+                                g_string_append(msg, resource->name);
+                                win_printline_nowrap(window->subwin, msg->str);
+                                g_string_free(msg, TRUE);
+
+                                wattroff(window->subwin, resource_presence_colour);
+
+                                ordered_resources = g_list_next(ordered_resources);
+                            }
+                            g_list_free(ordered_resources);
                         }
-
-                        g_list_free(resources);
-
-                        while (ordered_resources) {
-                            Resource *resource = ordered_resources->data;
-                            const char *resource_presence = string_from_resource_presence(resource->presence);
-                            int resource_presence_colour = win_presence_colour(resource_presence);
-                            wattron(window->subwin, resource_presence_colour);
-
-                            GString *msg = g_string_new("     ");
-                            g_string_append(msg, resource->name);
-                            win_printline_nowrap(window->subwin, msg->str);
-                            g_string_free(msg, TRUE);
-
-                            wattroff(window->subwin, resource_presence_colour);
-
-                            ordered_resources = g_list_next(ordered_resources);
-                        }
-                        g_list_free(ordered_resources);
                     }
                 }
                 curr_contact = g_slist_next(curr_contact);