mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Moved cons_show_account() to console module
This commit is contained in:
parent
996ba8181b
commit
6253897ea7
115
src/ui/console.c
115
src/ui/console.c
@ -663,6 +663,121 @@ cons_show_account_list(gchar **accounts)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_account(ProfAccount *account)
|
||||
{
|
||||
cons_show("");
|
||||
cons_show("Account %s:", account->name);
|
||||
if (account->enabled) {
|
||||
cons_show ("enabled : TRUE");
|
||||
} else {
|
||||
cons_show ("enabled : FALSE");
|
||||
}
|
||||
cons_show ("jid : %s", account->jid);
|
||||
if (account->resource != NULL) {
|
||||
cons_show ("resource : %s", account->resource);
|
||||
}
|
||||
if (account->server != NULL) {
|
||||
cons_show ("server : %s", account->server);
|
||||
}
|
||||
if (account->last_presence != NULL) {
|
||||
cons_show ("Last presence : %s", account->last_presence);
|
||||
}
|
||||
if (account->login_presence != NULL) {
|
||||
cons_show ("Login presence : %s", account->login_presence);
|
||||
}
|
||||
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
|
||||
account->priority_chat, account->priority_online, account->priority_away,
|
||||
account->priority_xa, account->priority_dnd);
|
||||
|
||||
if ((jabber_get_connection_status() == JABBER_CONNECTED) &&
|
||||
(g_strcmp0(jabber_get_account_name(), account->name) == 0)) {
|
||||
GList *resources = jabber_get_available_resources();
|
||||
GList *ordered_resources = NULL;
|
||||
|
||||
WINDOW *win = console->win;
|
||||
if (resources != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, "Resources:\n");
|
||||
|
||||
// sort in order of availabiltiy
|
||||
while (resources != NULL) {
|
||||
Resource *resource = resources->data;
|
||||
ordered_resources = g_list_insert_sorted(ordered_resources,
|
||||
resource, (GCompareFunc)resource_compare_availability);
|
||||
resources = g_list_next(resources);
|
||||
}
|
||||
}
|
||||
|
||||
while (ordered_resources != NULL) {
|
||||
Resource *resource = ordered_resources->data;
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
window_show_time(console, '-');
|
||||
window_presence_colour_on(console, resource_presence);
|
||||
wprintw(win, " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||
if (resource->status != NULL) {
|
||||
wprintw(win, ", \"%s\"", resource->status);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
window_presence_colour_off(console, resource_presence);
|
||||
|
||||
if (resource->caps_str != NULL) {
|
||||
Capabilities *caps = caps_get(resource->caps_str);
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " Identity: ");
|
||||
if (caps->name != NULL) {
|
||||
wprintw(win, "%s", caps->name);
|
||||
if ((caps->category != NULL) || (caps->type != NULL)) {
|
||||
wprintw(win, " ");
|
||||
}
|
||||
}
|
||||
if (caps->type != NULL) {
|
||||
wprintw(win, "%s", caps->type);
|
||||
if (caps->category != NULL) {
|
||||
wprintw(win, " ");
|
||||
}
|
||||
}
|
||||
if (caps->category != NULL) {
|
||||
wprintw(win, "%s", caps->category);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->software != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " Software: %s", caps->software);
|
||||
}
|
||||
if (caps->software_version != NULL) {
|
||||
wprintw(win, ", %s", caps->software_version);
|
||||
}
|
||||
if ((caps->software != NULL) || (caps->software_version != NULL)) {
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->os != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " OS: %s", caps->os);
|
||||
}
|
||||
if (caps->os_version != NULL) {
|
||||
wprintw(win, ", %s", caps->os_version);
|
||||
}
|
||||
if ((caps->os != NULL) || (caps->os_version != NULL)) {
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ordered_resources = g_list_next(ordered_resources);
|
||||
}
|
||||
}
|
||||
|
||||
dirty = TRUE;
|
||||
if (!win_current_is_console()) {
|
||||
status_bar_new(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_splash_logo(void)
|
||||
{
|
||||
|
110
src/ui/windows.c
110
src/ui/windows.c
@ -1105,116 +1105,6 @@ win_show_room_broadcast(const char * const room_jid, const char * const message)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_account(ProfAccount *account)
|
||||
{
|
||||
cons_show("");
|
||||
cons_show("Account %s:", account->name);
|
||||
if (account->enabled) {
|
||||
cons_show ("enabled : TRUE");
|
||||
} else {
|
||||
cons_show ("enabled : FALSE");
|
||||
}
|
||||
cons_show ("jid : %s", account->jid);
|
||||
if (account->resource != NULL) {
|
||||
cons_show ("resource : %s", account->resource);
|
||||
}
|
||||
if (account->server != NULL) {
|
||||
cons_show ("server : %s", account->server);
|
||||
}
|
||||
if (account->last_presence != NULL) {
|
||||
cons_show ("Last presence : %s", account->last_presence);
|
||||
}
|
||||
if (account->login_presence != NULL) {
|
||||
cons_show ("Login presence : %s", account->login_presence);
|
||||
}
|
||||
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
|
||||
account->priority_chat, account->priority_online, account->priority_away,
|
||||
account->priority_xa, account->priority_dnd);
|
||||
|
||||
if ((jabber_get_connection_status() == JABBER_CONNECTED) &&
|
||||
(g_strcmp0(jabber_get_account_name(), account->name) == 0)) {
|
||||
GList *resources = jabber_get_available_resources();
|
||||
GList *ordered_resources = NULL;
|
||||
|
||||
WINDOW *win = console->win;
|
||||
if (resources != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, "Resources:\n");
|
||||
|
||||
// sort in order of availabiltiy
|
||||
while (resources != NULL) {
|
||||
Resource *resource = resources->data;
|
||||
ordered_resources = g_list_insert_sorted(ordered_resources,
|
||||
resource, (GCompareFunc)resource_compare_availability);
|
||||
resources = g_list_next(resources);
|
||||
}
|
||||
}
|
||||
|
||||
while (ordered_resources != NULL) {
|
||||
Resource *resource = ordered_resources->data;
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
window_show_time(console, '-');
|
||||
window_presence_colour_on(console, resource_presence);
|
||||
wprintw(win, " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||
if (resource->status != NULL) {
|
||||
wprintw(win, ", \"%s\"", resource->status);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
window_presence_colour_off(console, resource_presence);
|
||||
|
||||
if (resource->caps_str != NULL) {
|
||||
Capabilities *caps = caps_get(resource->caps_str);
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " Identity: ");
|
||||
if (caps->name != NULL) {
|
||||
wprintw(win, "%s", caps->name);
|
||||
if ((caps->category != NULL) || (caps->type != NULL)) {
|
||||
wprintw(win, " ");
|
||||
}
|
||||
}
|
||||
if (caps->type != NULL) {
|
||||
wprintw(win, "%s", caps->type);
|
||||
if (caps->category != NULL) {
|
||||
wprintw(win, " ");
|
||||
}
|
||||
}
|
||||
if (caps->category != NULL) {
|
||||
wprintw(win, "%s", caps->category);
|
||||
}
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->software != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " Software: %s", caps->software);
|
||||
}
|
||||
if (caps->software_version != NULL) {
|
||||
wprintw(win, ", %s", caps->software_version);
|
||||
}
|
||||
if ((caps->software != NULL) || (caps->software_version != NULL)) {
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
if (caps->os != NULL) {
|
||||
window_show_time(console, '-');
|
||||
wprintw(win, " OS: %s", caps->os);
|
||||
}
|
||||
if (caps->os_version != NULL) {
|
||||
wprintw(win, ", %s", caps->os_version);
|
||||
}
|
||||
if ((caps->os != NULL) || (caps->os_version != NULL)) {
|
||||
wprintw(win, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ordered_resources = g_list_next(ordered_resources);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_show_status(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user