summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 3cf9877..9f6f5cf 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -894,9 +894,10 @@ int processircmessage(SSL *server_ssl, int *clientsockfd, char *str, int source,
// Custom BLABOUNCER command received
// Case insensitive comparisons here since clients won't be recognising and uppercasing these commands
if (strncasecmp(tokens[0], "BLABOUNCER", strlen(tokens[0])) == 0) {
+ printf("Client BLABOUNCER found and it is: %s with length %zd!\n", tokens[1], strlen(tokens[1]));
// REPLAY received, send the requested number of seconds of replay to the client
if (strncasecmp(tokens[1], "REPLAY", strlen(tokens[1])) == 0) {
- printf("Client REPLAY (custom blabouncer command) found and it is: %s with length %zd!\n", tokens[1], strlen(tokens[1]));
+ printf("Client BLABOUNCER REPLAY (custom blabouncer command) found and it is: %s with length %zd!\n", tokens[1], strlen(tokens[1]));
int replayseconds;
if ((replayseconds = strtol(tokens[2], NULL, 10)) == 0) {
printf("Invalid number of replay seconds provided by REPLAY. Telling client.\n");
@@ -911,9 +912,16 @@ int processircmessage(SSL *server_ssl, int *clientsockfd, char *str, int source,
doreplay(sourcefd, replayseconds, arr_clients, arr_authed, arr_ssl, settings);
return 1;
+ // Unrecognised BLABOUNCER command received, send some help instructions
+ } else {
+ printf("Client BLABOUNCER unrecognised command found and it is: %s with length %zd! Sending a help message.\n", tokens[1], strlen(tokens[1]));
+ char outgoingmsg[MAXDATASIZE];
+ snprintf(outgoingmsg, MAXDATASIZE, "Unrecognised BLABOUNCER command received. Valid commands are:");
+ sendtoclient(sourcefd, outgoingmsg, arr_clients, arr_authed, arr_ssl, settings);
+ snprintf(outgoingmsg, MAXDATASIZE, "\"BLABOUNCER REPLAY [seconds]\" (Where [seconds] is the number of seconds of replay log to replay.)");
+ sendtoclient(sourcefd, outgoingmsg, arr_clients, arr_authed, arr_ssl, settings);
+ return 1;
}
-
- // If here then although BLABOUNCER command received, it wasn't recognised, so don't return
}
break;