diff options
author | James Booth <boothj5@gmail.com> | 2013-03-14 23:41:36 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-03-14 23:41:36 +0000 |
commit | e2bc9bde749a5a0b48ffc2a331a9bf4cfa10af65 (patch) | |
tree | f90e17474273a8c97c0f3a84044d0b9c672d7406 /src/ui | |
parent | 7bd7c15994b50228b6f494a91daecd706eed9267 (diff) | |
download | profani-tty-e2bc9bde749a5a0b48ffc2a331a9bf4cfa10af65.tar.gz |
Implemented output for /disco info
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui.h | 1 | ||||
-rw-r--r-- | src/ui/windows.c | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h index d9c9e473..73aa5855 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -175,6 +175,7 @@ void cons_show_software_version(const char * const jid, void cons_show_account_list(gchar **accounts); void cons_show_room_list(GSList *room, const char * const conference_node); void cons_show_disco_items(GSList *items, const char * const jid); +void cons_show_disco_info(const char *from, GSList *identities, GSList *features); // status bar actions void status_bar_refresh(void); diff --git a/src/ui/windows.c b/src/ui/windows.c index b20dbeef..591bc737 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -1324,6 +1324,45 @@ 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("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)) { |