Add command subcommands: list and exec

Also handle list result
This commit is contained in:
Paul Fariello
2018-03-22 04:47:52 +02:20
parent ca022ec75e
commit c9f6a78f57
10 changed files with 158 additions and 26 deletions

View File

@@ -924,7 +924,7 @@ stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *c
xmpp_stanza_t*
stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id,
const char *const jid)
const char *const jid, const char *const node)
{
xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_GET, id);
xmpp_stanza_set_to(iq, jid);
@@ -932,6 +932,9 @@ stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id,
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
xmpp_stanza_set_ns(query, XMPP_NS_DISCO_ITEMS);
if (node) {
xmpp_stanza_set_attribute(query, STANZA_ATTR_NODE, node);
}
xmpp_stanza_add_child(iq, query);
xmpp_stanza_release(query);
@@ -2039,7 +2042,7 @@ stanza_parse_presence(xmpp_stanza_t *stanza, int *err)
}
xmpp_stanza_t*
stanza_create_command_iq(xmpp_ctx_t *ctx, const char *const target,
stanza_create_command_exec_iq(xmpp_ctx_t *ctx, const char *const target,
const char *const node)
{
char *id = create_unique_id("command");