[ADD/WIP] Make basic XMPP->Matrix redactions

I'll need to use the actual redaction endpoint eventually, hence the
WIP status.
This commit is contained in:
LDA 2024-07-07 21:52:38 +02:00
commit a167d5d724
3 changed files with 47 additions and 2 deletions

View file

@ -290,6 +290,34 @@ XMPPGetReplacedID(XMLElement *stanza)
return replace ? HashMapGet(replace->attrs, "id") : NULL;
}
char *
XMPPGetRetractedID(XMLElement *stanza)
{
XMLElement *retract = XMLookForTKV(
stanza, "retract",
"xmlns", "urn:xmpp:message-retract:1"
);
char *id = retract ? HashMapGet(retract->attrs, "id") : NULL;
if (!id)
{
/* Pretend its fastened */
XMLElement *fasten = XMLookForTKV(
stanza, "apply-to",
"xmlns", "urn:xmpp:fasten:0"
);
retract = XMLookForTKV(
fasten, "retract",
"xmlns", "urn:xmpp:message-retract:0"
);
if (retract)
{
id = HashMapGet(fasten->attrs, "id");
}
}
return id;
}
char *
XMPPGetReply(XMLElement *elem)
{
XMLElement *rep = XMLookForTKV(elem, "reply", "xmlns", "urn:xmpp:reply:0");