summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-20 22:35:59 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-20 22:35:59 +0100
commitad733362c0f09aaeb5be4862bcb50a78c4947792 (patch)
tree20295218b19a61d037e6d4ec5488bf37e95abb30 /blabouncer.c
parentd4adf9c516b6a0098571fe579519b88281c1d98a (diff)
Remove duplicated WHOIS reply handling section.
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 15b1eb4..78ddd9f 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -1108,29 +1108,6 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
return 1;
}
- // Server 307 (RPL_SUSERHOST), 311 (RPL_WHOISUSER), 317 (RPL_WHOISIDLE), 319 (RPL_WHOISCHANNELS), or 318 (RPL_ENDOFWHOIS) received?
- // Send to any clients who requested a WHOIS.
- if (strncmp(tokens[1], "307", strlen(tokens[1])) == 0 || strncmp(tokens[1], "311", strlen(tokens[1])) == 0 ||
- strncmp(tokens[1], "317", strlen(tokens[1])) == 0 || strncmp(tokens[1], "319", strlen(tokens[1])) == 0 ||
- strncmp(tokens[1], "318", strlen(tokens[1])) == 0) {
- printf("Server 307 RPL_SUSERHOST, 311 RPL_WHOISUSER, 317 RPL_WHOISIDLE, 319 RPL_WHOISCHANNELS, or 318 RPL_ENDOFWHOIS "
- "found and it is: %s with length %zd! Sending to clients who are pending one of these.\n", tokens[1], strlen(tokens[1]));
-
- // Relay to all pending clients
- for (int i = 0; i < MAXCLIENTS; i++) {
- if (clients[i].pendingwhowas == 1 && clients[i].fd) {
- sendtoclient(clients[i].fd, str, clients, settings);
- // And clear the pending flag if it's 318 RPL_ENDOFWHOIS
- if (strncmp(tokens[1], "318", strlen(tokens[1])) == 0) {
- clients[i].pendingwhowas = 0;
- }
- }
- }
-
- free(strcopyPtr);
- return 1;
- }
-
// Server 314 (RPL_WHOWASUSER), 406 (ERR_WASNOSUCHNICK), or 369 (RPL_ENDOFWHOWAS) received?
// Send to any clients who requested a WHOWAS.
if (strncmp(tokens[1], "314", strlen(tokens[1])) == 0 || strncmp(tokens[1], "406", strlen(tokens[1])) == 0 || strncmp(tokens[1], "369", strlen(tokens[1])) == 0) {
@@ -1177,7 +1154,8 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
}
- // Server 401 (ERR_NOSUCHNICK) received? Check to see if anyone was pending a WHOIS and send to them, if not send to everyone.
+ // Server 401 (ERR_NOSUCHNICK) received? Check to see if anyone was pending a WHOIS and send to them,
+ // if not send to everyone (401 was probably in reply to something else like a PRIVMSG).
if (strncmp(tokens[1], "401", strlen(tokens[1])) == 0) {
printf("Server 401 (ERR_NOSUCHNICK) found and it is: %s with length %zd! Sending to clients who are pending this or to everyone if nobody is.\n", tokens[1], strlen(tokens[1]));