summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-06 20:19:30 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-06 20:19:30 +0100
commit79236b70d01c0b355889bd66872c2ae5e64a2aba (patch)
treec4834e37fd593fb620caa84140537a975201a61f
parenta61ba3d2b90dcbb689b312be0458651488a8f826 (diff)
Change BLABOUNCER REPLAY to be D:H:M instead of D:H:M:S.
-rw-r--r--README2
-rw-r--r--TODO2
-rw-r--r--message.c31
3 files changed, 13 insertions, 22 deletions
diff --git a/README b/README
index 97bfb75..ff5e5e7 100644
--- a/README
+++ b/README
@@ -41,7 +41,7 @@ These options can be changed by issuing a BLABOUNCER REHASH command or by sendin
Once connected to blabouncer with an IRC client, you can use the following special blabouncer commands:
-"BLABOUNCER REPLAY [[[[days:]hours:]minutes:]seconds]" (To replay a given length of time of replay log.)
+"BLABOUNCER REPLAY [[[days:]hours:]minutes:]" (To replay a given length of time of replay log.)
"BLABOUNCER QUIT [quit message]" (To quit blabouncer, optionally sending [quit message] to the server.)
"BLABOUNCER REHASH" (To reload settings from the configuration file, see above for details.)
"BLABOUNCER CLIENTCODE [clientcode]" (To set an identifier for the current client for auto replaying just
diff --git a/TODO b/TODO
index ea24a8f..14b4d65 100644
--- a/TODO
+++ b/TODO
@@ -16,6 +16,4 @@ Add BLABOUNCER HELP as a valid command to avoid the unrecognised command error.
(I vaguely recall) some unwanted stuff (channel ban info?) was relayed to another client upon a client connecting.
-Change BLABOUNCER REPLAY to be D:H:M instead of D:H:M:S.
-
PM replay chat in a channel (or perhaps a random channel?) e.g. replay on 06/09/2019 at 17:05 from 13:49 in #insomnia - maybe a client thing.
diff --git a/message.c b/message.c
index ef16003..6aa2725 100644
--- a/message.c
+++ b/message.c
@@ -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);