1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

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>
This commit is contained in:
Michael Vetter 2021-03-25 17:07:41 +01:00
parent c72351375d
commit 3884a4d35b

View File

@ -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) {