mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 00:25:11 +00:00
[ADD] Be able to set the power level of an admin
Taking over users!
This commit is contained in:
parent
c4b7d1b92a
commit
307fe6a341
3 changed files with 69 additions and 1 deletions
44
src/AS.c
44
src/AS.c
|
|
@ -422,6 +422,50 @@ ASGetName(const ParseeConfig *c, char *room, char *user)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
HashMap *
|
||||
ASGetPL(const ParseeConfig *c, char *room)
|
||||
{
|
||||
char *path;
|
||||
HttpClientContext *ctx;
|
||||
HashMap *reply;
|
||||
if (!c || !room)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
room = HttpUrlEncode(room);
|
||||
path = StrConcat(4,
|
||||
"/_matrix/client/v3/rooms/", room,
|
||||
"/state/m.room.power_levels/", ""
|
||||
);
|
||||
ctx = ParseeCreateRequest(c, HTTP_GET, path);
|
||||
Free(room);
|
||||
ASAuthenticateRequest(c, ctx);
|
||||
HttpRequestSendHeaders(ctx);
|
||||
HttpRequestSend(ctx);
|
||||
|
||||
reply = JsonDecode(HttpClientStream(ctx));
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
Free(path);
|
||||
|
||||
return reply;
|
||||
}
|
||||
void
|
||||
ASSetPL(const ParseeConfig *conf, char *id, HashMap *m)
|
||||
{
|
||||
char *user;
|
||||
if (!conf || !id || !m)
|
||||
{
|
||||
return;
|
||||
}
|
||||
user = StrConcat(4,
|
||||
"@",conf->sender_localpart,
|
||||
":",conf->homeserver_host
|
||||
);
|
||||
ASSetState(conf, id, "m.room.power_levels", "", user, m);
|
||||
Free(user);
|
||||
}
|
||||
|
||||
char *
|
||||
ASUpload(const ParseeConfig *c, Stream *from, unsigned int size)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue