diff options
author | Luke Bratch <luke@bratch.co.uk> | 2025-08-08 23:11:31 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2025-08-08 23:11:31 +0100 |
commit | b2089e21606aed1a6aaa9644dbe0d2fe998ae1e0 (patch) | |
tree | 691e6edeeb7a040c8ae95cefe807346fd376f768 /message.c | |
parent | 0de8ed662321f25ab78cef094774593e1ce27677 (diff) |
Improve output of LISTCLIENTS blabouncer command, add identical listclients command to STDIN commands, declare STDIN commands ("debug commands") in README.
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -1535,15 +1535,28 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :There are %d blabouncer client(s) connected:", ircdstate->ircnick, numclients(clients)); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + // Loop through each client in clients struct for connected and authenticated clients... int clientcount = 0; + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Authenticated clients:", ircdstate->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + for (int i = 0; i < MAXCLIENTS; i++) { + if (clients[i].fd && clients[i].authed) { + // ...then tell the requesting client about them + clientcount++; + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :#%d: File descriptor: %d, IP: %s.", ircdstate->ircnick, clientcount, clients[i].fd, clients[i].remoteip); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + } + } - // Loop through each client in clients struct... + // And now loop through each client in clients struct for connected but unauthenticated clients... + clientcount = 0; + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unauthenticated clients:", ircdstate->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); for (int i = 0; i < MAXCLIENTS; i++) { - // ...and if they have a file descriptor... - if (clients[i].fd) { - // ... then tell the requesting client about them + if (clients[i].fd && !clients[i].authed) { + // ...then tell the requesting client about them clientcount++; - snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :#%d: File descriptor: %d, authenticated: %d, IP: %s.", ircdstate->ircnick, clientcount, clients[i].fd, clients[i].authed, clients[i].remoteip); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :#%d: File descriptor: %d, IP: %s.", ircdstate->ircnick, clientcount, clients[i].fd, clients[i].remoteip); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); } } |