summaryrefslogtreecommitdiff
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
parent979b594b9a58059a5159f2a950e0a71c64f35e38 (diff)
Only relay channel ban information to the client that requested it.
-rw-r--r--TODO2
-rw-r--r--message.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/TODO b/TODO
index 8a874af..5895d8b 100644
--- a/TODO
+++ b/TODO
@@ -4,8 +4,6 @@ Support arrays or similar in the configuration file (for nick(s), connectcommand
All the TODOs sprinkled throughout the code!
-(I vaguely recall) some unwanted stuff (channel ban info?) was relayed to another client upon a client connecting.
-
PM replay chat in a channel (or perhaps a random channel?) e.g. replay on 06/09/2019 at 17:05 from 13:49 in #insomnia - maybe a client thing.
Ensure replayed lines don't exceed IRC message maximum length due to inserted time/datestamp.
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;
+ }
}
}