diff options
author | James Booth <boothj5@gmail.com> | 2014-11-10 00:46:20 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-10 00:46:20 +0000 |
commit | 48afa523900db68f561d07b5ff6da5a8d0d7b80b (patch) | |
tree | 726840de386639105fef3258664637f5fa66ef51 /src/ui | |
parent | 36331e490829518974b58ead719588d9fefc9fee (diff) | |
download | profani-tty-48afa523900db68f561d07b5ff6da5a8d0d7b80b.tar.gz |
Show resources and only subscribed contacts in roster panel
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index 31575e67..1231adc2 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -2818,13 +2818,26 @@ _ui_roster(void) GSList *curr = contacts; while (curr) { PContact contact = curr->data; - const char *name = p_contact_name_or_jid(contact); - const char *presence = p_contact_presence(contact); - int presence_colour = win_presence_colour(presence); + if (p_contact_subscribed(contact)) { + const char *name = p_contact_name_or_jid(contact); + const char *presence = p_contact_presence(contact); + int presence_colour = win_presence_colour(presence); - wattron(window->subwin, presence_colour); - wprintw(window->subwin, " %s\n", name); - wattroff(window->subwin, presence_colour); + wattron(window->subwin, presence_colour); + wprintw(window->subwin, " %s\n", name); + wattroff(window->subwin, presence_colour); + GList *resources = p_contact_get_available_resources(contact); + GList *curr_resource = resources; + while (curr_resource) { + Resource *resource = curr_resource->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); + wprintw(window->subwin, " %s\n", resource->name); + wattroff(window->subwin, resource_presence_colour); + curr_resource = g_list_next(curr_resource); + } + } curr = g_slist_next(curr); } } |