diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-06-16 23:16:18 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-06-16 23:16:18 +0100 |
commit | 61906329ccbe96c25c75533f819dea269492f5a7 (patch) | |
tree | 647e407cb483fc13a26e616891c7504788bed813 /blabouncer.c | |
parent | 87b890b501a9ed7bfbfbe0fabde6ca1ca4c15086 (diff) |
Implement two new auto replay modes:
- replaymode = "noclients": All messages since the bouncer last had no clients connected
- replaymode = "lastchange": All messages since the last client connect or disconnect
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/blabouncer.c b/blabouncer.c index 3b0a538..95521f1 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -133,6 +133,7 @@ int connecttoircserver(SSL_CTX **serverctx, SSL **server_ssl, int *serversockfd, ircdstate->lastmessagetime = time(NULL); ircdstate->timeoutcheck = 0; // ircdstate.reconnecting is not set here as we want to track reconnections separately + // ircdstate.clientchangetime and ircdstate.clientsnonetime not set here as they are set at startup and only changed when clients connect/disconnect // Populate nick and username from our configuration file for now, real IRCd may change them later (TODO - Is this true of username?) strcpy(ircdstate->ircnick, settings->ircnick); @@ -412,9 +413,11 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { SSL_CTX *serverctx = NULL; SSL *server_ssl = NULL; // Need to create this either way as referenced later - // Set reconnection things to null/zero for now (not used unless reconnecting to server) + // Set reconnection and other things to null/zero for now (not used unless reconnecting to server) ircdstate.oldnick[0] = '\0'; ircdstate.reconnecting = 0; + ircdstate.clientchangetime = time(NULL); + ircdstate.clientsnonetime = time(NULL); if (!connecttoircserver(&serverctx, &server_ssl, serversockfd, &ircdstate, settings, clients)) { fprintf(stderr, "Failed to connect to IRC server, exiting.\n"); debugprint(DEBUG_CRIT, "Failed to connect to IRC server, exiting.\n"); @@ -877,8 +880,9 @@ int main(int argc, char *argv[]) { printf("main(): error getting 'replaymode' from configuration file.\n"); exit(1); } else { - if (strcmp(settings.replaymode, "none") && strcmp(settings.replaymode, "time") && strcmp(settings.replaymode, "lastspoke")) { - printf("main(): replaymode in configuration file must be one of \"none\", \"time\", or \"lastspoke\".\n"); + if (strcmp(settings.replaymode, "none") && strcmp(settings.replaymode, "time") && strcmp(settings.replaymode, "lastspoke") && + strcmp(settings.replaymode, "noclients") && strcmp(settings.replaymode, "lastchange")) { + printf("main(): replaymode in configuration file must be one of \"none\", \"time\", \"lastspoke\", \"noclients\", or \"lastchange\".\n"); exit(1); } } |