about summary refs log tree commit diff stats
path: root/src/xmpp/stanza.c
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-02-21 06:44:47 +0140
committerPaul Fariello <paul@fariello.eu>2019-04-10 15:37:22 +0200
commitbce19811283ae4aa6f919497579704de32e30877 (patch)
tree1c8eb5ec11e42ee6716377f2f44464859e43f203 /src/xmpp/stanza.c
parent2602cbf7852fa4317d961316b601a383b9077079 (diff)
downloadprofani-tty-bce19811283ae4aa6f919497579704de32e30877.tar.gz
Add devicelist subscription
Diffstat (limited to 'src/xmpp/stanza.c')
-rw-r--r--src/xmpp/stanza.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 534ee06b..ffd0c053 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -2092,6 +2092,31 @@ stanza_create_command_config_submit_iq(xmpp_ctx_t *ctx, const char *const room,
     return iq;
 }
 
+xmpp_stanza_t*
+stanza_create_omemo_devicelist_pubsub_subscription(xmpp_ctx_t *ctx, const char *const jid)
+{
+    char *id = connection_create_stanza_id("omemo_devicelist_subscribe");
+    xmpp_stanza_t *iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
+    free(id);
+
+    xmpp_stanza_t *pubsub = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(pubsub, STANZA_NAME_PUBSUB);
+    xmpp_stanza_set_ns(pubsub, STANZA_NS_PUBSUB);
+
+    xmpp_stanza_t *subscribe = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(subscribe, "subscribe");
+    xmpp_stanza_set_attribute(subscribe, "node", "eu.siacs.conversations.axolotl.devicelist");
+    xmpp_stanza_set_attribute(subscribe, "jid", jid);
+
+    xmpp_stanza_add_child(pubsub, subscribe);
+    xmpp_stanza_add_child(iq, pubsub);
+
+    xmpp_stanza_release(subscribe);
+    xmpp_stanza_release(pubsub);
+
+    return iq;
+}
+
 static void
 _stanza_add_unique_id(xmpp_stanza_t *stanza, char *prefix)
 {