From 3884a4d35bce3e306fc1b7e02d55184bc7a90f19 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 25 Mar 2021 17:07:41 +0100 Subject: 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 --- src/xmpp/message.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 - // 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) { -- cgit 1.4.1-2-gfad0