diff options
-rw-r--r-- | message.c | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -437,8 +437,16 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int sendtoallclients(clients, str, sourcefd, settings); + int dontwritereplay = 0; + + // If it seems to be a CTCP VERSION request, don't write to replay log + if (counter >= 4 && strncmp(tokens[3], ":\1VERSION\1", strlen(tokens[3])) == 0) { + debugprint(DEBUG_FULL, "Server PRIVMSG looked like a CTCP VERSION request, will not write to replay log.\n"); + dontwritereplay = 1; + } + // Write to replay log if replay logging enabled - if (settings->replaylogging) { + if (settings->replaylogging && !dontwritereplay) { writereplayline(str, settings->basedir); } @@ -801,8 +809,16 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int sendtoallclients(clients, str, 0, settings); + 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"); + dontwritereplay = 1; + } + // Write to replay log if replay logging enabled - if (settings->replaylogging) { + if (settings->replaylogging && !dontwritereplay) { writereplayline(str, settings->basedir); } @@ -1253,24 +1269,25 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int return 0; } - // Write to replay log if replay logging enabled - if (settings->replaylogging) { - writereplayline(fullmsg, settings->basedir); - } - // Write to normal log if logging enabled if (settings->logging) { 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.\n"); + debugprint(DEBUG_FULL, "Client NOTICE looked like a CTCP VERSION 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 let this fall through to the default unhandled action by not returning here + // If it wasn't a CTCP VERSION response, then write to replay log if replay logging enabled... + if (settings->replaylogging) { + writereplayline(fullmsg, settings->basedir); + } + + // ...and then let this fall through to the default unhandled action by not returning here } // Client PROTOCTL received |