[MOD] One-way Matrix->XMPP comms.

This is not sanitised. I need to make an XML writer.
This commit is contained in:
LDA 2024-06-17 18:26:37 +02:00
commit bdb4fd2f68
17 changed files with 421 additions and 61 deletions

41
src/Routes/UserAck.c Normal file
View file

@ -0,0 +1,41 @@
#include <Routes.h>
#include <Cytoplasm/Log.h>
#include <Matrix.h>
#include <AS.h>
RouteHead(RouteUserAck, arr, argp)
{
ParseeHttpArg *args = argp;
HashMap *request = NULL;
HashMap *response = NULL;
Array *events;
size_t i;
char *user = ArrayGet(arr, 0);
Log(LOG_INFO, "Alles Politischemacht");
response = ASVerifyRequest(args);
if (response)
{
goto end;
}
if (HttpRequestMethodGet(args->ctx) != HTTP_GET)
{
HttpResponseStatus(args->ctx, HTTP_METHOD_NOT_ALLOWED);
response = MatrixCreateError(
"M_UNRECOGNIZED",
"Path /users only accepts GET as a valid method."
);
goto end;
}
Log(LOG_INFO, "user=%s", user);
ASRegisterUser(args->data->config, user);
/* TODO: Verify the user, and create an XMPP mapping. */
response = HashMapCreate();
end:
JsonFree(request);
return response;
}