diff options
author | James Booth <boothj5@gmail.com> | 2013-06-01 23:27:46 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-06-01 23:27:46 +0100 |
commit | d49a01a9c37b6aff82cac6a61269a87b3bb211dd (patch) | |
tree | 8e97c6b38329b634dd3b283dc5323a4277460317 /src/ui/console.c | |
parent | 83c41776928a71faa858d509aa6cf8cf451569a7 (diff) | |
download | profani-tty-d49a01a9c37b6aff82cac6a61269a87b3bb211dd.tar.gz |
Added roster list when using /roster with no args
Diffstat (limited to 'src/ui/console.c')
-rw-r--r-- | src/ui/console.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 4e33376a..95c7d9b0 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1240,6 +1240,42 @@ cons_navigation_help(void) } void +cons_show_roster(GSList *list) +{ + GSList *curr = list; + cons_show(""); + cons_show("Roster:"); + + while(curr) { + PContact contact = curr->data; + GString *title = g_string_new(" "); + title = g_string_append(title, p_contact_barejid(contact)); + if (p_contact_name(contact) != NULL) { + title = g_string_append(title, " ("); + title = g_string_append(title, strdup(p_contact_name(contact))); + title = g_string_append(title, ")"); + } + cons_show(title->str); + g_string_free(title, TRUE); + + GString *sub = g_string_new(" Subscription : "); + sub = g_string_append(sub, p_contact_subscription(contact)); + if (p_contact_pending_out(contact)) { + sub = g_string_append(sub, ", request sent"); + } + if (presence_sub_request_exists(p_contact_barejid(contact))) { + sub = g_string_append(sub, ", request received"); + } + cons_show(sub->str); + g_string_free(sub, TRUE); + curr = g_slist_next(curr); + } + + ui_console_dirty(); + cons_alert(); +} + +void cons_show_contacts(GSList *list) { GSList *curr = list; |