diff options
author | Luke Bratch <luke@bratch.co.uk> | 2025-08-09 11:14:06 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2025-08-09 11:14:06 +0100 |
commit | 1d41511b7ffb607137308adabd6b2d06906d4023 (patch) | |
tree | 74c1be01b3d572a91fb14fc6936d6bfb7b3bcb60 | |
parent | fe6ac12dbe4a91cd8652421aaaae18fed23cc6e6 (diff) |
Add quit to STDIN commands.
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | blabouncer.c | 13 |
2 files changed, 14 insertions, 0 deletions
@@ -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 |