mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[MOD] One-way Matrix->XMPP comms.
This is not sanitised. I need to make an XML writer.
This commit is contained in:
parent
868f0e4d9c
commit
bdb4fd2f68
17 changed files with 421 additions and 61 deletions
29
src/AS.c
29
src/AS.c
|
|
@ -74,18 +74,23 @@ ASRegisterUser(ParseeConfig *conf, char *user)
|
|||
json = HashMapCreate();
|
||||
|
||||
HashMapSet(json,"type",JsonValueString("m.login.application_service"));
|
||||
|
||||
user = ParseeGetLocal(user);
|
||||
HashMapSet(json,"username",JsonValueString(user));
|
||||
|
||||
ASAuthenticateRequest(conf, ctx);
|
||||
status = ParseeSetRequestJSON(ctx, json);
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
JsonFree(json);
|
||||
|
||||
Free(user);
|
||||
|
||||
return status == HTTP_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ASPing(ParseeConfig *conf)
|
||||
ASPing(const ParseeConfig *conf)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL;
|
||||
|
|
@ -116,26 +121,20 @@ void
|
|||
ASJoin(ParseeConfig *conf, char *id, char *masquerade)
|
||||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL, *params_obj;
|
||||
char *path, *params;
|
||||
if (!conf || !id)
|
||||
HashMap *json = NULL;
|
||||
char *path;
|
||||
if (!conf || !id || !masquerade)
|
||||
{
|
||||
Log(LOG_ERR, "Bad values %p %p", conf, id);
|
||||
return;
|
||||
}
|
||||
|
||||
params_obj = HashMapCreate();
|
||||
if (masquerade)
|
||||
{
|
||||
HashMapSet(params_obj, "user_id", masquerade);
|
||||
}
|
||||
params = HttpParamEncode(params_obj);
|
||||
HashMapFree(params_obj);
|
||||
path = StrConcat(4,
|
||||
path = StrConcat(5,
|
||||
"/_matrix/client/v3/rooms/", id, "/join?",
|
||||
params
|
||||
"user_id=", masquerade
|
||||
);
|
||||
Free(params);
|
||||
|
||||
Log(LOG_INFO, "%s", path);
|
||||
ctx = ParseeCreateRequest(
|
||||
conf,
|
||||
HTTP_POST, path
|
||||
|
|
@ -144,6 +143,7 @@ ASJoin(ParseeConfig *conf, char *id, char *masquerade)
|
|||
json = HashMapCreate();
|
||||
ASAuthenticateRequest(conf, ctx);
|
||||
ParseeSetRequestJSON(ctx, json);
|
||||
|
||||
HttpClientContextFree(ctx);
|
||||
JsonFree(json);
|
||||
}
|
||||
|
|
@ -152,6 +152,7 @@ ASSend(ParseeConfig *conf, char *id, char *user, char *type, HashMap *c)
|
|||
{
|
||||
HttpClientContext *ctx = NULL;
|
||||
HashMap *json = NULL, *params_obj;
|
||||
Stream *s;
|
||||
char *path, *params;
|
||||
char *txn;
|
||||
if (!conf || !id || !type || !c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue