mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[FIX/WIP] Plumbing, -Werror, death to hitmen
Suspend killers are now no more. Except the actual killers to be gone eventually. Plumbing is also very basic as of now, but it "works".
This commit is contained in:
parent
1f658ece76
commit
bb836789b2
23 changed files with 310 additions and 165 deletions
42
src/AS.c
42
src/AS.c
|
|
@ -222,19 +222,33 @@ ASKick(const ParseeConfig *conf, char *id, char *banned)
|
|||
HttpClientContextFree(ctx);
|
||||
JsonFree(json);
|
||||
}
|
||||
void
|
||||
char *
|
||||
ASJoin(const ParseeConfig *conf, char *id, char *masquerade)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL;
|
||||
char *path;
|
||||
if (!conf || !id || !masquerade)
|
||||
char *path, *ret;
|
||||
if (!conf || !id)
|
||||
{
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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, "/join?",
|
||||
"/_matrix/client/v3/join/", id, "?",
|
||||
"user_id=", masquerade
|
||||
);
|
||||
|
||||
|
|
@ -246,15 +260,23 @@ ASJoin(const ParseeConfig *conf, char *id, char *masquerade)
|
|||
json = HashMapCreate();
|
||||
ASAuthenticateRequest(conf, ctx);
|
||||
ParseeSetRequestJSON(ctx, json);
|
||||
JsonFree(json);
|
||||
|
||||
json = JsonDecode(HttpClientStream(ctx));
|
||||
ret = StrDuplicate(GrabString(json, 1, "room_id"));
|
||||
JsonFree(json);
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
JsonFree(json);
|
||||
Free(masquerade);
|
||||
Free(id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
void
|
||||
ASSetState(const ParseeConfig *conf, char *id, char *type, char *key, char *mask, HashMap *state)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
char *path, *params;
|
||||
char *path;
|
||||
if (!conf || !id || !type || !mask || !state)
|
||||
{
|
||||
JsonFree(state);
|
||||
|
|
@ -278,7 +300,7 @@ char *
|
|||
ASSend(const ParseeConfig *conf, char *id, char *user, char *type, HashMap *c)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
char *path, *params;
|
||||
char *path;
|
||||
char *txn, *ret;
|
||||
HashMap *reply;
|
||||
if (!conf || !id || !type || !user || !c)
|
||||
|
|
@ -626,7 +648,6 @@ ASReupload(const ParseeConfig *c, char *from, char **mime)
|
|||
HttpClientContext *ctx;
|
||||
unsigned short port;
|
||||
int size = 0, flags = HTTP_FLAG_NONE;
|
||||
int i;
|
||||
char *ret, *content_len;
|
||||
|
||||
if (!c || !from)
|
||||
|
|
@ -685,7 +706,7 @@ ASType(const ParseeConfig *c, char *user, char *room, bool status)
|
|||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json;
|
||||
char *path, *full;
|
||||
char *path;
|
||||
if (!c || !user || !room)
|
||||
{
|
||||
return;
|
||||
|
|
@ -760,7 +781,6 @@ ASSetUserConfig(const ParseeConfig *c, char *user, char *key, HashMap *map)
|
|||
{
|
||||
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json;
|
||||
char *path;
|
||||
if (!c || !key || !map)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue