mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 12:15:12 +00:00
[WIP] Start MUCwerk
This commit is contained in:
parent
fe137e0a2a
commit
3ac11fd269
2 changed files with 37 additions and 4 deletions
|
|
@ -14,8 +14,6 @@ RouteHead(RouteUserAck, arr, argp)
|
|||
size_t i;
|
||||
|
||||
char *user = ArrayGet(arr, 0);
|
||||
|
||||
Log(LOG_INFO, "Alles Politischemacht");
|
||||
response = ASVerifyRequest(args);
|
||||
if (response)
|
||||
{
|
||||
|
|
@ -33,9 +31,43 @@ RouteHead(RouteUserAck, arr, argp)
|
|||
|
||||
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;
|
||||
}
|
||||
RouteHead(RouteRoomAck, arr, argp)
|
||||
{
|
||||
ParseeHttpArg *args = argp;
|
||||
HashMap *request = NULL;
|
||||
HashMap *response = NULL;
|
||||
Array *events;
|
||||
size_t i;
|
||||
|
||||
char *room = ArrayGet(arr, 0);
|
||||
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, "room=%s", room);
|
||||
|
||||
HttpResponseStatus(args->ctx, HTTP_METHOD_NOT_ALLOWED);
|
||||
response = MatrixCreateError(
|
||||
"M_UNRECOGNIZED",
|
||||
"Path /users only accepts GET as a valid method."
|
||||
);
|
||||
end:
|
||||
JsonFree(request);
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ typedef struct ParseeHttpArg {
|
|||
#define ROUTES X_ROUTE("/", RouteRoot) \
|
||||
X_ROUTE("/_matrix/app/v1/transactions/(.*)", RouteTxns) \
|
||||
X_ROUTE("/_matrix/app/v1/ping", RoutePing) \
|
||||
X_ROUTE("/_matrix/app/v1/users/(.*)", RouteUserAck)
|
||||
X_ROUTE("/_matrix/app/v1/users/(.*)", RouteUserAck) \
|
||||
X_ROUTE("/_matrix/app/v1/rooms/(.*)", RouteRoomAck)
|
||||
|
||||
#define X_ROUTE(path, name) extern void * name(Array *, void *);
|
||||
ROUTES
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue