mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 15:15:10 +00:00
[ADD/WIP] Continue MUCwerk
oh man this is gonna be painful to do... xmpp is fine iff youre doing DMs isnt it?
This commit is contained in:
parent
3ac11fd269
commit
d3b7f2fee0
19 changed files with 707 additions and 44 deletions
19
src/Main.c
19
src/Main.c
|
|
@ -1,5 +1,7 @@
|
|||
#include <Cytoplasm/HttpServer.h>
|
||||
#include <Cytoplasm/Cytoplasm.h>
|
||||
#include <Cytoplasm/Memory.h>
|
||||
#include <Cytoplasm/Util.h>
|
||||
#include <Cytoplasm/Log.h>
|
||||
#include <Cytoplasm/Str.h>
|
||||
|
||||
|
|
@ -34,7 +36,9 @@ SignalHandler(int signal)
|
|||
return;
|
||||
}
|
||||
/* Create a loopback stanza, forcing the thread to die */
|
||||
XMPPKillThread(jabber);
|
||||
Log(LOG_INFO, "Killing thread...");
|
||||
XMPPKillThread(jabber, "killer");
|
||||
pthread_join(xmpp_thr, NULL);
|
||||
HttpServerStop(server);
|
||||
break;
|
||||
}
|
||||
|
|
@ -49,7 +53,12 @@ Main(void)
|
|||
Stream *yaml;
|
||||
struct sigaction sigAction;
|
||||
|
||||
Log(LOG_INFO, "%s - v%s", NAME, VERSION);
|
||||
Log(LOG_INFO,
|
||||
"%s - v%s (Cytoplasm %s)",
|
||||
NAME, VERSION, CytoplasmGetVersionStr()
|
||||
);
|
||||
LogConfigIndent(LogConfigGlobal());
|
||||
|
||||
ParseeConfigLoad("parsee.json");
|
||||
ParseeConfigInit();
|
||||
|
||||
|
|
@ -90,7 +99,7 @@ Main(void)
|
|||
if (pthread_create(&xmpp_thr, NULL, ParseeXMPPThread, conf.handlerArgs))
|
||||
{
|
||||
Log(LOG_ERR, "Couldn't start XMPP listener thread.");
|
||||
/* TODO: Die */
|
||||
goto end;
|
||||
}
|
||||
|
||||
sigAction.sa_handler = SignalHandler;
|
||||
|
|
@ -101,6 +110,7 @@ Main(void)
|
|||
if (sigaction(sig, act, oact) < 0) \
|
||||
{ \
|
||||
Log(LOG_ERR, "Unable to install signal handler: %s", #sig); \
|
||||
goto end; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
|
|
@ -113,12 +123,15 @@ Main(void)
|
|||
SIGACTION(SIGUSR1, &sigAction, NULL);
|
||||
|
||||
#undef SIGACTION
|
||||
Log(LOG_INFO, "%d", XMPPQueryMUC(jabber, "rootard@muc.ari.lt", NULL));
|
||||
|
||||
server = HttpServerCreate(&conf);
|
||||
HttpServerStart(server);
|
||||
HttpServerJoin(server);
|
||||
|
||||
end:
|
||||
LogConfigUnindent(LogConfigGlobal());
|
||||
Log(LOG_INFO, "Exiting...");
|
||||
HttpServerFree(server);
|
||||
ParseeConfigFree();
|
||||
ParseeFreeData(conf.handlerArgs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue