mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added output for /disco items
This commit is contained in:
parent
681c3b6be2
commit
7bd7c15994
@ -408,6 +408,13 @@ prof_handle_room_list(GSList *rooms, const char *conference_node)
|
|||||||
win_current_page_off();
|
win_current_page_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prof_handle_disco_items(GSList *items, const char *jid)
|
||||||
|
{
|
||||||
|
cons_show_disco_items(items, jid);
|
||||||
|
win_current_page_off();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take a line of input and process it, return TRUE if profanity is to
|
* Take a line of input and process it, return TRUE if profanity is to
|
||||||
* continue, FALSE otherwise
|
* continue, FALSE otherwise
|
||||||
|
@ -72,5 +72,6 @@ void prof_handle_version_result(const char * const jid,
|
|||||||
const char * const presence, const char * const name,
|
const char * const presence, const char * const name,
|
||||||
const char * const version, const char * const os);
|
const char * const version, const char * const os);
|
||||||
void prof_handle_room_list(GSList *rooms, const char *conference_node);
|
void prof_handle_room_list(GSList *rooms, const char *conference_node);
|
||||||
|
void prof_handle_disco_items(GSList *items, const char *jid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -174,6 +174,7 @@ void cons_show_software_version(const char * const jid,
|
|||||||
const char * const version, const char * const os);
|
const char * const version, const char * const os);
|
||||||
void cons_show_account_list(gchar **accounts);
|
void cons_show_account_list(gchar **accounts);
|
||||||
void cons_show_room_list(GSList *room, const char * const conference_node);
|
void cons_show_room_list(GSList *room, const char * const conference_node);
|
||||||
|
void cons_show_disco_items(GSList *items, const char * const jid);
|
||||||
|
|
||||||
// status bar actions
|
// status bar actions
|
||||||
void status_bar_refresh(void);
|
void status_bar_refresh(void);
|
||||||
|
@ -1323,6 +1323,26 @@ cons_show_room_list(GSList *rooms, const char * const conference_node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_show_disco_items(GSList *items, const char * const jid)
|
||||||
|
{
|
||||||
|
if ((items != NULL) && (g_slist_length(items) > 0)) {
|
||||||
|
cons_show("Service discovery items for %s:", jid);
|
||||||
|
while (items != NULL) {
|
||||||
|
DiscoItem *item = items->data;
|
||||||
|
_win_show_time(console->win, '-');
|
||||||
|
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("No service discovery items for %s", jid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_show_status(const char * const contact)
|
cons_show_status(const char * const contact)
|
||||||
{
|
{
|
||||||
|
@ -495,10 +495,10 @@ _iq_handle_discoitems_result(xmpp_conn_t * const conn, xmpp_stanza_t * const sta
|
|||||||
const char *stanza_name = NULL;
|
const char *stanza_name = NULL;
|
||||||
const char *item_jid = NULL;
|
const char *item_jid = NULL;
|
||||||
const char *item_name = NULL;
|
const char *item_name = NULL;
|
||||||
|
|
||||||
if (g_strcmp0(id, "confreq") == 0) {
|
|
||||||
log_debug("Response to query: %s", id);
|
|
||||||
GSList *items = NULL;
|
GSList *items = NULL;
|
||||||
|
|
||||||
|
if ((g_strcmp0(id, "confreq") == 0) || (g_strcmp0(id, "discoitemsreq") == 0)) {
|
||||||
|
log_debug("Response to query: %s", id);
|
||||||
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||||
|
|
||||||
if (query != NULL) {
|
if (query != NULL) {
|
||||||
@ -523,12 +523,15 @@ _iq_handle_discoitems_result(xmpp_conn_t * const conn, xmpp_stanza_t * const sta
|
|||||||
child = xmpp_stanza_get_next(child);
|
child = xmpp_stanza_get_next(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prof_handle_room_list(items, from);
|
|
||||||
g_slist_free_full(items, free);
|
|
||||||
} else if ((id != NULL) && (g_strcmp0(id, "discoitemsreq") == 0)) {
|
|
||||||
cons_show("GOT DISO ITEMS RESULT");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(id, "confreq") == 0) {
|
||||||
|
prof_handle_room_list(items, from);
|
||||||
|
} else if (g_strcmp0(id, "discoitemsreq") == 0) {
|
||||||
|
prof_handle_disco_items(items, from);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_slist_free_full(items, free);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user