mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Colour connected account in "/account list" according ot presence
This commit is contained in:
parent
657d1d4a49
commit
f1693278cb
@ -1081,19 +1081,8 @@ _cmd_account(gchar **args, struct cmd_help_t help)
|
||||
|
||||
if (strcmp(command, "list") == 0) {
|
||||
gchar **accounts = accounts_get_list();
|
||||
int size = g_strv_length(accounts);
|
||||
|
||||
if (size > 0) {
|
||||
cons_show("Accounts:");
|
||||
int i = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
cons_show(accounts[i]);
|
||||
}
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("No accounts created yet.");
|
||||
cons_show("");
|
||||
}
|
||||
cons_show_account_list(accounts);
|
||||
g_strfreev(accounts);
|
||||
} else if (strcmp(command, "show") == 0) {
|
||||
char *account_name = args[1];
|
||||
if (account_name == NULL) {
|
||||
|
@ -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);
|
||||
|
@ -1305,6 +1305,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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user