summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2024-07-17 23:05:34 +0100
committerLuke Bratch <luke@bratch.co.uk>2024-07-17 23:05:34 +0100
commita0706572740221e06874d243bed87e49714aad79 (patch)
tree4151a9e10af8e985adf18d837fb13209c8be04ef
parent69b1cec737fff5d4c547d8879d4c0899124b7e69 (diff)
Don't write any CTCP responses to the replay log file, and encourage bug reporting if the replay log file cannot be read.
-rw-r--r--TODO4
-rw-r--r--message.c25
2 files changed, 13 insertions, 16 deletions
diff --git a/TODO b/TODO
index c446127..affeb29 100644
--- a/TODO
+++ b/TODO
@@ -53,7 +53,3 @@ QUIT not logged in all channels a person was in? (e.g. Joey Mon 1 Apr 20:49:14
Print VERSION in debug.txt.
"/whois" with no nick - "No nickname given" goes to all clients - fixable?
-
-CTCP PING logs an invalid replay line.
-
-Invalid replay lines break autoreplay.
diff --git a/message.c b/message.c
index 8284268..6f4c9dd 100644
--- a/message.c
+++ b/message.c
@@ -149,7 +149,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int
if (clients[i].fd) {
char alertmsg[MAXDATASIZE];
if (!doautoreplay(clients[i].fd, clients, settings, ircdstate, channels)) {
- snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstate->ircnick);
+ snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file, please report this if you are expecting it to work!", ircdstate->ircnick);
sendtoclient(sourcefd, alertmsg, clients, settings, 0);
}
snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :Reconnection complete.", ircdstate->ircnick);
@@ -848,9 +848,10 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int
int dontwritereplay = 0;
- // If it seems to be a CTCP VERSION response, don't write to replay log
- if (counter >= 4 && strncmp(tokens[3], ":\1VERSION", strlen(tokens[3])) == 0) {
- debugprint(DEBUG_FULL, "Server NOTICE looked like a CTCP VERSION response, will not write to replay log.\n");
+ // If it seems to be a CTCP response, don't write to replay log
+ // to avoid logging and replay weirdness of potentially automated NOTICEs.
+ if (counter >= 4 && strncmp(tokens[3], ":\1", strlen(":\1")) == 0) {
+ debugprint(DEBUG_FULL, "Server NOTICE looked like a CTCP response, will not write to replay log.\n");
dontwritereplay = 1;
}
@@ -1125,7 +1126,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
// Catch the client up using whichever replaymode is set
if (!doautoreplay(sourcefd, clients, settings, ircdstate, channels)) {
- snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstate->ircnick);
+ snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file, please report this if you are expecting it to work!", ircdstate->ircnick);
sendtoclient(sourcefd, outgoingmsg, clients, settings, 0);
}
@@ -1317,15 +1318,15 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
logline(fullmsg, ircdstate, settings->basedir, LOG_PRIVMSG);
}
- // If it's a CTCP VERSION response then only send to the server (CTCP requests are delimited with \1)
- // and don't write to replay log
- if (counter >= 3 && strncmp(tokens[2], ":\1VERSION", strlen(tokens[2])) == 0) {
- debugprint(DEBUG_FULL, "Client NOTICE looked like a CTCP VERSION response, so just sending to the server (and not writing to replay log).\n");
+ // If it seems to be a CTCP response, just send to the server and don't write to replay log
+ // to avoid logging and replay weirdness of potentially automated NOTICEs.
+ if (counter >= 3 && strncmp(tokens[2], ":\1", strlen(":\1")) == 0) {
+ debugprint(DEBUG_FULL, "Client NOTICE looked like a CTCP response, so just sending to the server (and not writing to replay log).\n");
sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);
return 1;
}
- // If it wasn't a CTCP VERSION response, then write to replay log if replay logging enabled...
+ // If it wasn't a CTCP response, then write to replay log if replay logging enabled...
if (settings->replaylogging) {
writereplayline(fullmsg, settings->basedir);
}
@@ -1432,7 +1433,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
debugprint(DEBUG_FULL, "Replaying '%s' which is '%d' seconds.\n", tokens[2], replayseconds);
if (!doreplaytime(sourcefd, replayseconds, clients, settings, ircdstate, channels)) {
- snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstate->ircnick);
+ snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file, please report this if you are expecting it to work!", ircdstate->ircnick);
sendtoclient(sourcefd, outgoingmsg, clients, settings, 0);
}
free(timestrcopyPtr);
@@ -1510,7 +1511,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
return 1;
}
if (!doreplaytime(sourcefd, time(NULL) - codetime, clients, settings, ircdstate, channels)) {
- snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstate->ircnick);
+ snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file, please report this if you are expecting it to work!", ircdstate->ircnick);
sendtoclient(sourcefd, outgoingmsg, clients, settings, 0);
return 1;
}