From 1d41511b7ffb607137308adabd6b2d06906d4023 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sat, 9 Aug 2025 11:14:06 +0100 Subject: Add quit to STDIN commands. --- README | 1 + blabouncer.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README b/README index dec0475..e3e5c7b 100644 --- a/README +++ b/README @@ -117,3 +117,4 @@ If run in foreground mode, the following commands can be sent to standard input: "listchannels" (To list all joined channels and their members.) "reopenssl" (To reload the client-side TLS certificate/key.) "listclients" (To list all connected clients and their authentication status.) +"quit" (To quit blabouncer.) diff --git a/blabouncer.c b/blabouncer.c index f4b084e..2e569a1 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -842,6 +842,19 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { continue; } + // STDIN: Quit blabouncer + if (strncmp(outgoingmsg, "quit", strlen("quit")) == 0) { + printf("STDIN command starting: quit\n"); + debugprint(DEBUG_SOME, "dochat(): stdin: STDIN command starting: quit\n"); + + cleanexit(server_ssl, clients, 0, &ircdstate, settings, ""); + + debugprint(DEBUG_SOME, "dochat(): stdin: STDIN command complete: quit\n"); + printf("STDIN command complete: quit\n"); + + continue; + } + debugprint(DEBUG_FULL, "dochat(): stdin: '%s' not processed as a command, sending to server.\n", outgoingmsg); printf("'%s' not processed as a command, sending to server.\n", outgoingmsg); // sourcefd = 0 as this is a trusted message -- cgit v1.2.3