diff options
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 31 |
1 files changed, 12 insertions, 19 deletions
@@ -861,7 +861,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Valid blabouncer commands are:", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); - snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REPLAY [[[[days:]hours:]minutes:]seconds]\" (To replay a given length of time of replay log.)", ircdstate->ircnick); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REPLAY [[[days:]hours:]minutes:]\" (To replay a given length of time of replay log.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REHASH\" (To reload settings from the configuration file, see README for which settings can be reloaded.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); @@ -1165,7 +1165,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int if (strncasecmp(tokens[1], "REPLAY", strlen("REPLAY")) == 0 && counter == 3) { debugprint(DEBUG_FULL, "Client BLABOUNCER REPLAY (custom blabouncer command) found and it is: %s with length %zd!\n", tokens[1], strlen(tokens[1])); - // Split the request into days:hours:minutes:seconds + // Split the request into days:hours:minutes // Track which colon-separated token within this request we're on int timecounter = 0; @@ -1187,10 +1187,10 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int timecounter++; } - // Make sure we don't have more than four (d:h:m:s) components - if (timecounter > 4) { + // Make sure we don't have more than three (d:h:m) components + if (timecounter > 3) { debugprint(DEBUG_SOME, "Too many time components requested by REPLAY command. Telling client.\n"); - snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Too many time components requestd by REPLAY command. Expected up to four (days:hours:minutes:seconds).", ircdstate->ircnick); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Too many time components requestd by REPLAY command. Expected up to three (days:hours:minutes).", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); free(timestrcopyPtr); return 1; @@ -1219,27 +1219,20 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int // How many seconds we're going to replay int replayseconds = 0; - // If d:h:m:s provided - if (timecounter == 4) { + // If d:h:m provided + if (timecounter == 3) { replayseconds += 86400 * strtol(timetokens[0], NULL, 10); replayseconds += 3600 * strtol(timetokens[1], NULL, 10); replayseconds += 60 * strtol(timetokens[2], NULL, 10); - replayseconds += strtol(timetokens[3], NULL, 10); } - // If h:m:s provided - if (timecounter == 3) { + // If h:m provided + if (timecounter == 2) { replayseconds += 3600 * strtol(timetokens[0], NULL, 10); replayseconds += 60 * strtol(timetokens[1], NULL, 10); - replayseconds += strtol(timetokens[2], NULL, 10); } - // If m:s provided - if (timecounter == 2) { - replayseconds += 60 * strtol(timetokens[0], NULL, 10); - replayseconds += strtol(timetokens[1], NULL, 10); - } - // If s provided + // If m provided if (timecounter == 1) { - replayseconds += strtol(timetokens[0], NULL, 10); + replayseconds += 60 * strtol(timetokens[0], NULL, 10); } debugprint(DEBUG_FULL, "Replaying '%s' which is '%d' seconds.\n", tokens[2], replayseconds); @@ -1335,7 +1328,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int debugprint(DEBUG_SOME, "Client BLABOUNCER unrecognised command found and it is: %s with length %zd! Sending a help message.\n", tokens[1], strlen(tokens[1])); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unrecognised BLABOUNCER command received. Valid commands are:", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); - snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REPLAY [[[[days:]hours:]minutes:]seconds]\" (To replay a given length of time of replay log.)", ircdstate->ircnick); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REPLAY [[[days:]hours:]minutes:]\" (To replay a given length of time of replay log.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER REHASH\" (To reload settings from the configuration file, see README for which settings can be reloaded.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); |