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

Moved cons_show_disco_info() and cons_show_disco_items() to console

module
This commit is contained in:
James Booth 2013-04-21 01:00:03 +01:00
parent d6c2bd0c6a
commit d7cc54db63
2 changed files with 71 additions and 62 deletions

View File

@ -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)
{

View File

@ -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)
{