diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-05-20 22:35:59 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-05-20 22:35:59 +0100 |
commit | ad733362c0f09aaeb5be4862bcb50a78c4947792 (patch) | |
tree | 20295218b19a61d037e6d4ec5488bf37e95abb30 | |
parent | d4adf9c516b6a0098571fe579519b88281c1d98a (diff) |
Remove duplicated WHOIS reply handling section.
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | blabouncer.c | 26 |
2 files changed, 4 insertions, 28 deletions
@@ -22,10 +22,8 @@ Maybe only do 433 handling if we're not registered yet? If ChanServ gives us +q upon and then +o upon JOINing a channel, we only see +o if we are connected to blabouncer. If (re)connecting, we see a strange ~@nick status. Also don't seem to be able to set -q from blabouncer. -Support autojoining passwords channels. +Support autojoining passworded channels. Test CTCP. -VSZ shows as ~2 TiB in ps: -USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND -test123 7218 0.0 0.8 21474910660 32744 pts/22 S+ May19 0:00 ./blabouncer +Reconnect server if we get disconnected for some reason. 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])); |