mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 18:35:11 +00:00
[ADD] External URL for media events
This commit is contained in:
parent
43b3f8aaf5
commit
517622a4ac
1 changed files with 18 additions and 9 deletions
|
|
@ -576,11 +576,19 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||||
char *mxc, *mime = NULL;
|
char *mxc, *mime = NULL;
|
||||||
HashMap *content = NULL;
|
HashMap *content = NULL;
|
||||||
oob_data = XMLookForUnique(oob, "url");
|
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);
|
mxc = ASReupload(args->config, oob_data->data, &mime);
|
||||||
content = MatrixCreateMedia(mxc, 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(
|
event_id = ASSend(
|
||||||
args->config, mroom_id, encoded,
|
args->config, mroom_id, encoded,
|
||||||
"m.room.message", content
|
"m.room.message", content
|
||||||
|
|
@ -588,6 +596,7 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||||
Free(mime);
|
Free(mime);
|
||||||
Free(mxc);
|
Free(mxc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (reactions)
|
else if (reactions)
|
||||||
{
|
{
|
||||||
Array *react_child = reactions->children;
|
Array *react_child = reactions->children;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue