mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 00:25:11 +00:00
[ADD/WIP] Do leaves right, PLwerk
This commit is contained in:
parent
5da9743cb1
commit
4d055f3688
3 changed files with 114 additions and 9 deletions
44
src/AS.c
44
src/AS.c
|
|
@ -273,6 +273,50 @@ ASJoin(const ParseeConfig *conf, char *id, char *masquerade)
|
|||
return ret;
|
||||
}
|
||||
void
|
||||
ASLeave(const ParseeConfig *conf, char *id, char *masquerade)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL;
|
||||
char *path;
|
||||
if (!conf || !id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!masquerade)
|
||||
{
|
||||
char *raw = StrConcat(4,
|
||||
"@", conf->sender_localpart,
|
||||
":", conf->homeserver_host
|
||||
);
|
||||
masquerade = HttpUrlEncode(raw);
|
||||
Free(raw);
|
||||
}
|
||||
else
|
||||
{
|
||||
masquerade = HttpUrlEncode(masquerade);
|
||||
}
|
||||
id = HttpUrlEncode(id);
|
||||
path = StrConcat(5,
|
||||
"/_matrix/client/v3/rooms/", id, "/leave?",
|
||||
"user_id=", masquerade
|
||||
);
|
||||
|
||||
ctx = ParseeCreateRequest(
|
||||
conf,
|
||||
HTTP_POST, path
|
||||
);
|
||||
Free(path);
|
||||
json = HashMapCreate();
|
||||
ASAuthenticateRequest(conf, ctx);
|
||||
ParseeSetRequestJSON(ctx, json);
|
||||
JsonFree(json);
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
Free(masquerade);
|
||||
Free(id);
|
||||
}
|
||||
void
|
||||
ASSetState(const ParseeConfig *conf, char *id, char *type, char *key, char *mask, HashMap *state)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue