about summary refs log tree commit diff stats
path: root/src/xmpp/stanza.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-10 16:17:01 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-10 16:17:01 +0100
commit11181100712fc2a1c2f310b4470d752488e8961e (patch)
treecd5b5341d86e48e7df09c6bfc9414dfc296144ca /src/xmpp/stanza.c
parent83b61e5160b6624eb0b2898c1321d33341e6510c (diff)
downloadprofani-tty-11181100712fc2a1c2f310b4470d752488e8961e.tar.gz
xep-0308: Implement `/correct` to correct the last send message
So far the correction is sent. But the UI in Profanity itself is not
updated.

Also autocompletion for `/correct` with the last sent message is
missing.
Diffstat (limited to 'src/xmpp/stanza.c')
-rw-r--r--src/xmpp/stanza.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index f398a268..7b0db5c7 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -2606,3 +2606,15 @@ stanza_create_avatar_retrieve_data_request(xmpp_ctx_t *ctx, const char *stanza_i
 
     return iq;
 }
+
+xmpp_stanza_t*
+stanza_attach_correction(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const replace_id)
+{
+    xmpp_stanza_t *replace_stanza = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(replace_stanza, "replace");
+    xmpp_stanza_set_id(replace_stanza, replace_id);
+    xmpp_stanza_set_ns(replace_stanza, STANZA_NS_LAST_MESSAGE_CORRECTION);
+    xmpp_stanza_add_child(stanza, replace_stanza);
+
+    return stanza;
+}