[MOD] Do not quit on corpseless stanzas.

Reactions seems to suffer from that problem...
This commit is contained in:
LDA 2024-08-01 22:50:32 +02:00
commit 253731268d

View file

@ -126,17 +126,12 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
} }
#undef CHAT_STATES #undef CHAT_STATES
if (!body)
{
XMLFreeElement(stanza);
return false;
}
to = ParseeDecodeMXID(HashMapGet(stanza->attrs, "to")); to = ParseeDecodeMXID(HashMapGet(stanza->attrs, "to"));
decode_from = ParseeLookupJID(from); decode_from = ParseeLookupJID(from);
from_matrix = ParseeEncodeJID(args->config, decode_from, true); from_matrix = ParseeEncodeJID(args->config, decode_from, true);
room = ParseeFindDMRoom(args, to, from); room = ParseeFindDMRoom(args, to, from);
data = ArrayGet(body->children, 0); data = body ? ArrayGet(body->children, 0) : NULL;
/* TODO: CLEAN THAT UP */ /* TODO: CLEAN THAT UP */
mroom_id = ParseeGetBridgedRoom(args, stanza); mroom_id = ParseeGetBridgedRoom(args, stanza);
@ -219,12 +214,13 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
ASInvite(args->config, mroom_id, encoded); ASInvite(args->config, mroom_id, encoded);
Free(ASJoin(args->config, mroom_id, encoded)); Free(ASJoin(args->config, mroom_id, encoded));
/* Check if it is a media link */
oob = XMLookForTKV(stanza, "x", "xmlns", "jabber:x:oob");
reactions = XMLookForTKV(stanza, reactions = XMLookForTKV(stanza,
"reactions", "xmlns", "urn:xmpp:reactions:0" "reactions", "xmlns", "urn:xmpp:reactions:0"
); );
if (oob)
/* Check if it is a media link */
oob = XMLookForTKV(stanza, "x", "xmlns", "jabber:x:oob");
if (oob && data)
{ {
char *mxc, *mime = NULL; char *mxc, *mime = NULL;
HashMap *content = NULL; HashMap *content = NULL;
@ -286,7 +282,7 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
Free(event_id); Free(event_id);
event_id = NULL; event_id = NULL;
} }
else else if (data)
{ {
/* TODO: Use HTML-formatted bodies, and respect the fallback /* TODO: Use HTML-formatted bodies, and respect the fallback
* trims the stanza provides us if possible. Element does not * trims the stanza provides us if possible. Element does not
@ -311,7 +307,7 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
Free(event_id); Free(event_id);
pthread_mutex_unlock(&thr->info->chk_lock); pthread_mutex_unlock(&thr->info->chk_lock);
} }
else if (replaced) else if (replaced && data)
{ {
event_id = ParseeGetEventFromID(args, stanza, replaced); event_id = ParseeGetEventFromID(args, stanza, replaced);
Free(ASSend( Free(ASSend(