mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[ADD/WIP] Basic moderation
You now can ban people, yoohoo!
This commit is contained in:
parent
e21785afcb
commit
46489b50e6
5 changed files with 140 additions and 6 deletions
35
src/AS.c
35
src/AS.c
|
|
@ -118,6 +118,41 @@ ASPing(const ParseeConfig *conf)
|
|||
JsonFree(json);
|
||||
}
|
||||
void
|
||||
ASBan(const ParseeConfig *conf, char *id, char *banned)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL;
|
||||
char *path, *bridge;
|
||||
if (!conf || !id || !banned)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bridge = StrConcat(4,
|
||||
"@", conf->sender_localpart,
|
||||
":", conf->homeserver_host
|
||||
);
|
||||
path = StrConcat(5,
|
||||
"/_matrix/client/v3/rooms/", id, "/ban",
|
||||
"?user_id=", bridge
|
||||
);
|
||||
Free(bridge);
|
||||
|
||||
ctx = ParseeCreateRequest(
|
||||
conf,
|
||||
HTTP_POST, path
|
||||
);
|
||||
Free(path);
|
||||
json = HashMapCreate();
|
||||
HashMapSet(json, "user_id", JsonValueString(banned));
|
||||
HashMapSet(json, "reason", JsonValueString("Parsee felt jealous."));
|
||||
ASAuthenticateRequest(conf, ctx);
|
||||
ParseeSetRequestJSON(ctx, json);
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
JsonFree(json);
|
||||
}
|
||||
void
|
||||
ASJoin(const ParseeConfig *conf, char *id, char *masquerade)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue