[ADD] External URL for media events

This commit is contained in:
LDA 2024-07-07 18:27:37 +02:00
commit 517622a4ac

View file

@ -576,11 +576,19 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
char *mxc, *mime = NULL;
HashMap *content = NULL;
oob_data = XMLookForUnique(oob, "url");
oob_data = ArrayGet(oob_data->children, 0);
oob_data =
oob_data ? ArrayGet(oob_data->children, 0) : NULL;
if (oob_data)
{
mxc = ASReupload(args->config, oob_data->data, &mime);
content = MatrixCreateMedia(mxc, data->data, mime);
/* Yeah, no, I'm not modifying the media creation code. */
HashMapSet(content, "external_url",
JsonValueString(oob_data->data)
);
event_id = ASSend(
args->config, mroom_id, encoded,
"m.room.message", content
@ -588,6 +596,7 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
Free(mime);
Free(mxc);
}
}
else if (reactions)
{
Array *react_child = reactions->children;