summaryrefslogtreecommitdiff
path: root/message.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-07 15:44:36 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-07 15:44:36 +0100
commit6ae84b9245bfaa832f847a31952b2ae33daf2299 (patch)
tree883305916613726becadb7e6d65fc578c96f4424 /message.c
parent979b594b9a58059a5159f2a950e0a71c64f35e38 (diff)
Only relay channel ban information to the client that requested it.
Diffstat (limited to 'message.c')
-rw-r--r--message.c12
1 files changed, 7 insertions, 5 deletions
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;
+ }
}
}