[MOD] Read the config file for tool DB access

This commit is contained in:
LDA 2024-09-08 16:12:27 +02:00
commit 9775bd8d4e
6 changed files with 157 additions and 115 deletions

View file

@ -230,34 +230,31 @@ end_error:
char *res = ParseeGetResource(from);
char *encoded = ParseeGetBridgedUser(args, stanza);
char *event_id = NULL;
char *parsee = ParseeJID(args);
char *trim = ParseeTrimJID(from);
XMLElement *ps;
{
char *parsee = ParseeJID(args);
char *trim = ParseeTrimJID(from);
XMLElement *ps;
/* Subscribe to the sender's metadata node. */
ps = CreatePubsubRequest(
parsee, decode_from, "urn:xmpp:avatar:metadata"
);
pthread_mutex_lock(&jabber->write_lock);
XMLEncode(jabber->stream, ps);
StreamFlush(jabber->stream);
pthread_mutex_unlock(&jabber->write_lock);
XMLFreeElement(ps);
/* Subscribe to the sender's metadata node. */
ps = CreatePubsubRequest(
parsee, decode_from, "urn:xmpp:avatar:metadata"
);
pthread_mutex_lock(&jabber->write_lock);
XMLEncode(jabber->stream, ps);
StreamFlush(jabber->stream);
pthread_mutex_unlock(&jabber->write_lock);
XMLFreeElement(ps);
ps = CreatePubsubRequest(
parsee, trim, "urn:xmpp:avatar:metadata"
);
pthread_mutex_lock(&jabber->write_lock);
XMLEncode(jabber->stream, ps);
StreamFlush(jabber->stream);
pthread_mutex_unlock(&jabber->write_lock);
XMLFreeElement(ps);
ps = CreatePubsubRequest(
parsee, trim, "urn:xmpp:avatar:metadata"
);
pthread_mutex_lock(&jabber->write_lock);
XMLEncode(jabber->stream, ps);
StreamFlush(jabber->stream);
pthread_mutex_unlock(&jabber->write_lock);
XMLFreeElement(ps);
Free(parsee);
Free(trim);
}
Free(parsee);
Free(trim);
pthread_mutex_lock(&thr->info->chk_lock);
if (ParseeVerifyAllStanza(args, stanza) && !replaced)
@ -317,6 +314,7 @@ end_error:
size_t reacts = ArraySize(react_child);
event_id = ParseeGetReactedEvent(args, stanza);
/* Redact the last few reactions. */
to_redact = ASGetRelations(
args->config, 30, mroom_id, event_id,
"m.reaction"
@ -335,6 +333,7 @@ end_error:
}
ASFreeRelations(to_redact);
/* ... and push out the new ones. */
for (i = 0; i < reacts; i++)
{
XMLElement *reaction, *react_data;
@ -365,9 +364,9 @@ end_error:
}
else if (data)
{
/* 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. */
/* TODO: Respect the fallback 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);