diff options
author | James Booth <boothj5@gmail.com> | 2013-02-18 22:07:17 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-02-18 22:07:17 +0000 |
commit | f1693278cb906a75effca482fb9bf4080df1f037 (patch) | |
tree | 80d848fb4b900725a28fa21f47253e62e05e07a7 /src/ui | |
parent | 657d1d4a493a30570a657a071943fcd14c7d124c (diff) | |
download | profani-tty-f1693278cb906a75effca482fb9bf4080df1f037.tar.gz |
Colour connected account in "/account list" according ot presence
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui.h | 1 | ||||
-rw-r--r-- | src/ui/windows.c | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h index 4ff10679..11c32b8f 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -171,6 +171,7 @@ void cons_show_login_success(ProfAccount *account); void cons_show_software_version(const char * const jid, const char * const presence, const char * const name, const char * const version, const char * const os); +void cons_show_account_list(gchar **accounts); // status bar actions void status_bar_refresh(void); diff --git a/src/ui/windows.c b/src/ui/windows.c index aecba904..a7d82a6e 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -1306,6 +1306,32 @@ cons_show_status(const char * const contact) } void +cons_show_account_list(gchar **accounts) +{ + int size = g_strv_length(accounts); + if (size > 0) { + cons_show("Accounts:"); + int i = 0; + for (i = 0; i < size; i++) { + if ((jabber_get_connection_status() == JABBER_CONNECTED) && + (g_strcmp0(jabber_get_account_name(), accounts[i]) == 0)) { + resource_presence_t presence = accounts_get_last_presence(accounts[i]); + _win_show_time(console->win, '-'); + _presence_colour_on(console->win, string_from_resource_presence(presence)); + wprintw(console->win, "%s\n", accounts[i]); + _presence_colour_off(console->win, string_from_resource_presence(presence)); + } else { + cons_show(accounts[i]); + } + } + cons_show(""); + } else { + cons_show("No accounts created yet."); + cons_show(""); + } +} + +void win_show_status(void) { char *recipient = win_current_get_recipient(); |