about summary refs log tree commit diff stats
path: root/src/xmpp/stanza.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-03-18 20:32:12 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-25 11:05:58 +0100
commitfde0a0d1c65ff61eb3d5bb9c07d6974d4fdac1f6 (patch)
tree5665fcc576e40222f0ed1e3e9bb1d2ba55b31b89 /src/xmpp/stanza.c
parent064174efa3604404fd1b8a5c34cf69ed93ab12dc (diff)
downloadprofani-tty-fde0a0d1c65ff61eb3d5bb9c07d6974d4fdac1f6.tar.gz
Add support to register with a room
`/affiliation register` can now be used to register a nickname with a
MUC.

Tested with a server without forms. Couldn't find a server which
supports forms yet.

Implements https://github.com/profanity-im/profanity/issues/1210
Diffstat (limited to 'src/xmpp/stanza.c')
-rw-r--r--src/xmpp/stanza.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 32892311..9145f9ec 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -2828,3 +2828,18 @@ stanza_create_approve_voice(xmpp_ctx_t* ctx, const char* const id, const char* c
 
     return message;
 }
+
+xmpp_stanza_t*
+stanza_create_muc_register_nick(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node, DataForm* form)
+{
+    xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
+
+    xmpp_stanza_set_to(iq, jid);
+
+    xmpp_stanza_t* x = form_create_submission(form);
+
+    xmpp_stanza_add_child(iq, x);
+    xmpp_stanza_release(x);
+
+    return iq;
+}