about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-12 13:07:52 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-12 13:07:52 +0100
commited1d49bf0c12328e687bac5641b522f6ee5075d9 (patch)
tree50f41db64ae3a5f4c8b94be4f2827d04061d7800
parent7cd1be36f213042b3a94a66ac6f9975d82b5ee1f (diff)
downloadprofani-tty-ed1d49bf0c12328e687bac5641b522f6ee5075d9.tar.gz
xep-0308: correct incoming MUC PMs
-rw-r--r--src/xmpp/message.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 7b10376e..aa519755 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -966,6 +966,20 @@ _private_chat_handler(xmpp_stanza_t *const stanza)
     const gchar *from = xmpp_stanza_get_from(stanza);
     message->jid = jid_create(from);
 
+    // message stanza id
+    const char *id = xmpp_stanza_get_id(stanza);
+    if (id) {
+        message->id = strdup(id);
+    }
+
+    xmpp_stanza_t *replace_id_stanza = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_LAST_MESSAGE_CORRECTION);
+    if (replace_id_stanza) {
+        const char *replace_id = xmpp_stanza_get_id(replace_id_stanza);
+        if (replace_id) {
+            message->replace_id = strdup(replace_id);
+        }
+    }
+
     // check omemo encryption
 #ifdef HAVE_OMEMO
     message->plain = omemo_receive_message(stanza, &message->trusted);