[FIX/ADD] Fix deadlock and DMs.

This commit is contained in:
LDA 2024-06-30 17:15:03 +02:00
commit 59d5ad6780
7 changed files with 57 additions and 34 deletions

View file

@ -118,6 +118,41 @@ ASPing(const ParseeConfig *conf)
JsonFree(json);
}
void
ASInvite(const ParseeConfig *conf, char *id, char *invited)
{
HttpClientContext *ctx = NULL;
HashMap *json = NULL;
char *path, *bridge;
if (!conf || !id || !invited)
{
return;
}
bridge = StrConcat(4,
"@", conf->sender_localpart,
":", conf->homeserver_host
);
path = StrConcat(5,
"/_matrix/client/v3/rooms/", id, "/invite",
"?user_id=", bridge
);
Free(bridge);
ctx = ParseeCreateRequest(
conf,
HTTP_POST, path
);
Free(path);
json = HashMapCreate();
HashMapSet(json, "user_id", JsonValueString(invited));
HashMapSet(json, "reason", JsonValueString("Pass over."));
ASAuthenticateRequest(conf, ctx);
ParseeSetRequestJSON(ctx, json);
HttpClientContextFree(ctx);
JsonFree(json);
}
void
ASBan(const ParseeConfig *conf, char *id, char *banned)
{
HttpClientContext *ctx = NULL;