mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 00:45:10 +00:00
[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:
parent
517622a4ac
commit
a167d5d724
3 changed files with 47 additions and 2 deletions
|
|
@ -527,6 +527,7 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
|||
char *encoded = ParseeEncodeJID(args->config, decode_from, false);
|
||||
char *event_id = NULL;
|
||||
char *replaced = XMPPGetReplacedID(stanza);
|
||||
char *retracted = XMPPGetRetractedID(stanza);
|
||||
char *reply_to = XMPPGetReply(stanza);
|
||||
bool chat = false;
|
||||
|
||||
|
|
@ -618,11 +619,26 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
|||
Free(event_id);
|
||||
event_id = NULL;
|
||||
}
|
||||
else if (retracted)
|
||||
{
|
||||
/* TODO: Use an actual redact. Not doing it now because it's not
|
||||
* fun to do at the moment... */
|
||||
event_id = ParseeGetEventFromID(args, stanza, retracted);
|
||||
Free(ASSend(
|
||||
args->config, mroom_id, encoded, "m.room.message",
|
||||
MatrixCreateReplace(event_id, "[Retracted]")
|
||||
));
|
||||
ParseePushAllStanza(args, stanza, event_id);
|
||||
pthread_mutex_unlock(&thr->info->chk_lock);
|
||||
|
||||
Free(event_id);
|
||||
event_id = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: Use HTML-formatted bodies, and respect the fallback
|
||||
* trims the stanza provides us if possible. Element does
|
||||
* not like raw bodies on replies too. Go figure. */
|
||||
* trims the stanza provides us if possible. Element does not
|
||||
* like raw bodies on replies too. Go figure. */
|
||||
size_t off =
|
||||
reply_to ? ParseeFindDatastart(data->data) : 0;
|
||||
HashMap *ev = MatrixCreateMessage(data->data + off);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue