From 6ae84b9245bfaa832f847a31952b2ae33daf2299 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sat, 7 Sep 2019 15:44:36 +0100 Subject: Only relay channel ban information to the client that requested it. --- message.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'message.c') diff --git a/message.c b/message.c index 1c511d2..9058814 100644 --- a/message.c +++ b/message.c @@ -477,17 +477,19 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int return 1; } - // Server 368 (RPL_ENDOFBANLIST) received? Send to any clients who requested a ban MODE query. - TODO - Identify and handle start/middle of ban responses. - if (strncmp(tokens[1], "368", strlen(tokens[1])) == 0) { - debugprint(DEBUG_FULL, "Server 368 (RPL_ENDOFBANLIST) found and it is: %s with length %zd! Sending to clients who are pending this.\n", + // Server 367 (RPL_BANLIST) or 368 (RPL_ENDOFBANLIST) received? Send to any clients who requested a ban MODE query. + if (strncmp(tokens[1], "367", strlen(tokens[1])) == 0 || strncmp(tokens[1], "368", strlen(tokens[1])) == 0) { + debugprint(DEBUG_FULL, "Server 367 (RPL_BANLIST) or 368 (RPL_ENDOFBANLIST) found and it is: %s with length %zd! Sending to clients who are pending this.\n", tokens[1], strlen(tokens[1])); // Relay to all pending clients for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i].pendingban == 1) { sendtoclient(clients[i].fd, str, clients, settings, 0); - // And clear the pending flag - clients[i].pendingban = 0; + // And clear the pending flag if it's 368 (RPL_ENDOFBANLIST) + if (strncmp(tokens[1], "368", strlen(tokens[1])) == 0) { + clients[i].pendingban = 0; + } } } -- cgit v1.2.3