about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-15 23:18:23 +0000
committerJames Booth <boothj5@gmail.com>2015-11-15 23:18:23 +0000
commit1d9d893ec0b58b33df1b2039622abac37fbec70c (patch)
tree4d4e019f06c0d7dc887151144b01fe7ad3924bc5
parentc31ba8c06613ca9d68e306ebb8686bfaa766537b (diff)
downloadprofani-tty-1d9d893ec0b58b33df1b2039622abac37fbec70c.tar.gz
Tidy rosterwin
-rw-r--r--src/ui/rosterwin.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index b19f9858..3073c85b 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -122,31 +122,9 @@ _rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
         }
     } else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
         const char *presence = p_contact_presence(contact);
+        const char *status = p_contact_status(contact);
         theme_item_t presence_colour = theme_main_presence_attrs(presence);
-        char *by = prefs_get_string(PREF_ROSTER_BY);
-        gboolean by_presence = g_strcmp0(by, "presence") == 0;
-        gboolean has_status = p_contact_status(contact) != NULL;
-        gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
-        if (!by_presence || (has_status && show_status)) {
-            wattron(layout->subwin, theme_attrs(presence_colour));
-            GString *msg = g_string_new("     ");
-            if (!by_presence) {
-                g_string_append(msg, presence);
-            }
-            if (has_status && show_status) {
-                if (!by_presence) {
-                    g_string_append(msg, ", \"");
-                } else {
-                    g_string_append(msg, "\"");
-                }
-                const char *status = p_contact_status(contact);
-                g_string_append(msg, status);
-                g_string_append(msg, "\"");
-            }
-            win_printline_nowrap(layout->subwin, msg->str);
-            g_string_free(msg, TRUE);
-            wattroff(layout->subwin, theme_attrs(presence_colour));
-        }
+        _rosterwin_presence(layout, 4, presence_colour, presence, status);
     }
     g_list_free(resources);