mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 16:55:10 +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
|
|
@ -6,8 +6,6 @@ RouteHead(RouteRoot, arr, argp)
|
|||
{
|
||||
ParseeHttpArg *args = argp;
|
||||
|
||||
ASPing(args->data->config);
|
||||
|
||||
HttpResponseHeader(args->ctx, "Content-Type", "text/html");
|
||||
HttpSendHeaders(args->ctx);
|
||||
StreamPrintf(args->stream, "<html lang=\"en\">");
|
||||
|
|
@ -30,5 +28,6 @@ RouteHead(RouteRoot, arr, argp)
|
|||
StreamPrintf(args->stream, " </p>");
|
||||
StreamPrintf(args->stream, " </body>");
|
||||
StreamPrintf(args->stream, "</html>");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ RouteHead(RouteTxns, arr, argp)
|
|||
for (i = 0; i < ArraySize(events); i++)
|
||||
{
|
||||
HashMap *event = JsonValueAsObject(ArrayGet(events, i));
|
||||
ParseeEventHandler(args->data->config, event);
|
||||
ParseeEventHandler(args->data, event);
|
||||
}
|
||||
|
||||
/* TODO: Store TXN ID somewhere so that we can commit
|
||||
|
|
|
|||
41
src/Routes/UserAck.c
Normal file
41
src/Routes/UserAck.c
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue