diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-09-07 15:44:36 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-09-07 15:44:36 +0100 |
commit | 6ae84b9245bfaa832f847a31952b2ae33daf2299 (patch) | |
tree | 883305916613726becadb7e6d65fc578c96f4424 /message.c | |
parent | 979b594b9a58059a5159f2a950e0a71c64f35e38 (diff) |
Only relay channel ban information to the client that requested it.
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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; + } } } |