From d7cc54db6302155fe7e1670b510496f8db40c9ac Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 21 Apr 2013 01:00:03 +0100 Subject: Moved cons_show_disco_info() and cons_show_disco_items() to console module --- src/ui/console.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ui/windows.c | 62 ------------------------------------------------- 2 files changed, 71 insertions(+), 62 deletions(-) (limited to 'src/ui') diff --git a/src/ui/console.c b/src/ui/console.c index d9f42e89..41b189c2 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -513,6 +513,77 @@ cons_show_room_list(GSList *rooms, const char * const conference_node) } } +void +cons_show_disco_info(const char *jid, GSList *identities, GSList *features) +{ + if (((identities != NULL) && (g_slist_length(identities) > 0)) || + ((features != NULL) && (g_slist_length(features) > 0))) { + cons_show(""); + cons_show("Service disovery info for %s", jid); + + if (identities != NULL) { + cons_show(" Identities"); + } + while (identities != NULL) { + DiscoIdentity *identity = identities->data; // anme trpe, cat + GString *identity_str = g_string_new(" "); + if (identity->name != NULL) { + identity_str = g_string_append(identity_str, strdup(identity->name)); + identity_str = g_string_append(identity_str, " "); + } + if (identity->type != NULL) { + identity_str = g_string_append(identity_str, strdup(identity->type)); + identity_str = g_string_append(identity_str, " "); + } + if (identity->category != NULL) { + identity_str = g_string_append(identity_str, strdup(identity->category)); + } + cons_show(identity_str->str); + g_string_free(identity_str, FALSE); + identities = g_slist_next(identities); + } + + if (features != NULL) { + cons_show(" Features:"); + } + while (features != NULL) { + cons_show(" %s", features->data); + features = g_slist_next(features); + } + + dirty = TRUE; + if (!win_current_is_console()) { + status_bar_new(0); + } + } +} + +void +cons_show_disco_items(GSList *items, const char * const jid) +{ + if ((items != NULL) && (g_slist_length(items) > 0)) { + cons_show(""); + cons_show("Service discovery items for %s:", jid); + while (items != NULL) { + DiscoItem *item = items->data; + window_show_time(console, '-'); + wprintw(console->win, " %s", item->jid); + if (item->name != NULL) { + wprintw(console->win, ", (%s)", item->name); + } + wprintw(console->win, "\n"); + items = g_slist_next(items); + } + } else { + cons_show(""); + cons_show("No service discovery items for %s", jid); + } + dirty = TRUE; + if (!win_current_is_console()) { + status_bar_new(0); + } +} + static void _cons_splash_logo(void) { diff --git a/src/ui/windows.c b/src/ui/windows.c index 66da6316..c8252efa 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -1106,68 +1106,6 @@ win_show_room_broadcast(const char * const room_jid, const char * const message) } } -void -cons_show_disco_info(const char *jid, GSList *identities, GSList *features) -{ - if (((identities != NULL) && (g_slist_length(identities) > 0)) || - ((features != NULL) && (g_slist_length(features) > 0))) { - cons_show(""); - cons_show("Service disovery info for %s", jid); - - if (identities != NULL) { - cons_show(" Identities"); - } - while (identities != NULL) { - DiscoIdentity *identity = identities->data; // anme trpe, cat - GString *identity_str = g_string_new(" "); - if (identity->name != NULL) { - identity_str = g_string_append(identity_str, strdup(identity->name)); - identity_str = g_string_append(identity_str, " "); - } - if (identity->type != NULL) { - identity_str = g_string_append(identity_str, strdup(identity->type)); - identity_str = g_string_append(identity_str, " "); - } - if (identity->category != NULL) { - identity_str = g_string_append(identity_str, strdup(identity->category)); - } - cons_show(identity_str->str); - g_string_free(identity_str, FALSE); - identities = g_slist_next(identities); - } - - if (features != NULL) { - cons_show(" Features:"); - } - while (features != NULL) { - cons_show(" %s", features->data); - features = g_slist_next(features); - } - } -} - -void -cons_show_disco_items(GSList *items, const char * const jid) -{ - if ((items != NULL) && (g_slist_length(items) > 0)) { - cons_show(""); - cons_show("Service discovery items for %s:", jid); - while (items != NULL) { - DiscoItem *item = items->data; - window_show_time(console, '-'); - wprintw(console->win, " %s", item->jid); - if (item->name != NULL) { - wprintw(console->win, ", (%s)", item->name); - } - wprintw(console->win, "\n"); - items = g_slist_next(items); - } - } else { - cons_show(""); - cons_show("No service discovery items for %s", jid); - } -} - void cons_show_status(const char * const contact) { -- cgit 1.4.1-2-gfad0