1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Moved cons_show_account_list() to console module

This commit is contained in:
James Booth 2013-04-21 01:18:04 +01:00
parent 60acd47780
commit 996ba8181b
2 changed files with 36 additions and 26 deletions

View File

@ -625,6 +625,42 @@ cons_show_room_invite(const char * const invitor, const char * const room,
jid_destroy(room_jid);
g_string_free(default_service, TRUE);
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
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]);
window_show_time(console, '-');
window_presence_colour_on(console, string_from_resource_presence(presence));
wprintw(console->win, "%s\n", accounts[i]);
window_presence_colour_off(console, string_from_resource_presence(presence));
} else {
cons_show(accounts[i]);
}
}
cons_show("");
} else {
cons_show("No accounts created yet.");
cons_show("");
}
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
static void

View File

@ -1105,32 +1105,6 @@ win_show_room_broadcast(const char * const room_jid, const char * const message)
}
}
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]);
window_show_time(console, '-');
window_presence_colour_on(console, string_from_resource_presence(presence));
wprintw(console->win, "%s\n", accounts[i]);
window_presence_colour_off(console, string_from_resource_presence(presence));
} else {
cons_show(accounts[i]);
}
}
cons_show("");
} else {
cons_show("No accounts created yet.");
cons_show("");
}
}
void
cons_show_account(ProfAccount *account)
{