From ad733362c0f09aaeb5be4862bcb50a78c4947792 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 20 May 2019 22:35:59 +0100 Subject: Remove duplicated WHOIS reply handling section. --- blabouncer.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'blabouncer.c') 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])); -- cgit v1.2.3