about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-03-25 17:07:41 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-25 17:09:52 +0100
commit3884a4d35bce3e306fc1b7e02d55184bc7a90f19 (patch)
tree7c365f7f3c7a08424109c30e7b396cbc94e0f054
parentc72351375d079439367996fad2623dcedfdb4aa8 (diff)
downloadprofani-tty-3884a4d35bce3e306fc1b7e02d55184bc7a90f19.tar.gz
message: parse stanzaid in MUC case
There was a todo for this in message.c which got forgotten.

This was most likely also the reason why there were NULL entries for
this in the DB which DebXWoody mentioned in the MUC.

Thus comparison was with NULL and no new entries were added to the
database.

Edit:
After checking pull requests I see Stefans draft PR:
https://github.com/profanity-im/profanity/pull/1505

So let's add him as co-author.

Co-authored-by: Stefan Kropp <stefan@debxwoody.de>
-rw-r--r--src/xmpp/message.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index f638bd2e..33d58cde 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -1048,6 +1048,15 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
         message->id = strdup(id);
     }
 
+    char* stanzaid = NULL;
+    xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
+    if (stanzaidst) {
+        stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
+        if (stanzaid) {
+            message->stanzaid = strdup(stanzaid);
+        }
+    }
+
     xmpp_stanza_t* origin = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID);
     if (origin) {
         char* originid = (char*)xmpp_stanza_get_attribute(origin, STANZA_ATTR_ID);
@@ -1348,7 +1357,6 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
         }
     } else {
         // live messages use XEP-0359 <stanza-id>
-        // TODO: add to muc too
         char* stanzaid = NULL;
         xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
         if (stanzaidst) {