[ADD/WIP] Start making a simple SAX parser, ASwerk

This commit is contained in:
LDA 2024-06-15 12:29:34 +02:00
commit 79217d3608
14 changed files with 1066 additions and 26 deletions

View file

@ -4,6 +4,7 @@
#include <string.h>
#include <Parsee.h>
#include <XML.h>
#include <AS.h>
int
@ -12,7 +13,7 @@ Main(void)
HttpServer *server = NULL;
HttpServerConfig conf;
ParseeData *data;
const ParseeConfig *parseeConf;
const ParseeConfig *parsee_conf;
Stream *yaml;
Log(LOG_INFO, "%s - v%s", NAME, VERSION);
@ -23,29 +24,14 @@ Main(void)
ParseeExportConfigYAML(yaml);
StreamClose(yaml);
parseeConf = ParseeConfigGet();
Log(LOG_INFO, "HS token: %s", parseeConf->hs_token);
parsee_conf = ParseeConfigGet();
Log(LOG_INFO, "HS token: %s", parsee_conf->hs_token);
ASRegisterUser(parsee_conf, parsee_conf->sender_localpart);
{
/* Create user. We don't actually care about the value as we can
* masquerade, as long as it exists. */
HttpClientContext *ctx = ParseeCreateRequest(
parseeConf,
HTTP_POST, "/_matrix/client/v3/register"
);
HashMap *json = HashMapCreate();
HashMapSet(json,"type",JsonValueString("m.login.application_service"));
HashMapSet(json,"username",JsonValueString(parseeConf->sender_localpart));
ASAuthenticateRequest(parseeConf, ctx);
Log(LOG_INFO, "Got %d", ParseeSetRequestJSON(ctx, json));
HttpClientContextFree(ctx);
JsonFree(json);
}
memset(&conf, 0, sizeof(conf));
conf.port = parseeConf->port;
conf.port = parsee_conf->port;
conf.threads = 4;
conf.maxConnections = 32;
conf.handlerArgs = ParseeInitData();
@ -54,6 +40,8 @@ Main(void)
/* TODO: The rest of Parsee. */
server = HttpServerCreate(&conf);
HttpServerStart(server);
/* TODO: Manage signals(^C) with finesse */
HttpServerJoin(server);
HttpServerFree(server);