[ADD/MOD] XMPP->Matrix media bridge, small cleanup

This commit is contained in:
LDA 2024-06-23 15:34:51 +02:00
commit 42d69226f0
14 changed files with 327 additions and 54 deletions

View file

@ -2,6 +2,7 @@
#include <Cytoplasm/Cytoplasm.h>
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Util.h>
#include <Cytoplasm/Cron.h>
#include <Cytoplasm/Log.h>
#include <Cytoplasm/Str.h>
@ -26,6 +27,7 @@ Main(void)
ParseeData *data = NULL;
const ParseeConfig *parsee_conf;
Stream *yaml;
Cron *cron = NULL;
Log(LOG_INFO,
"%s - v%s (Cytoplasm %s)",
@ -63,6 +65,7 @@ Main(void)
Log(LOG_NOTICE, "Setting up local Matrix user...");
ASRegisterUser(parsee_conf, parsee_conf->sender_localpart);
memset(&conf, 0, sizeof(conf));
conf.port = parsee_conf->port;
conf.threads = 4;
@ -70,6 +73,10 @@ Main(void)
conf.handlerArgs = ParseeInitData(jabber);
conf.handler = ParseeRequest;
Log(LOG_NOTICE, "Starting up local cronjobs...");
cron = CronCreate( 10 SECONDS );
CronEvery(cron, 30 MINUTES, ParseeCleanup, conf.handlerArgs);
Log(LOG_NOTICE, "Creating XMPP listener thread...");
if (pthread_create(&xmpp_thr, NULL, ParseeXMPPThread, conf.handlerArgs))
{
@ -98,6 +105,8 @@ end:
Log(LOG_INFO, "Exiting...");
HttpServerFree(server);
ParseeConfigFree();
CronStop(cron);
CronFree(cron);
ParseeFreeData(conf.handlerArgs);
return 0;
}