diff options
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | blabouncer.c | 30 | 
2 files changed, 17 insertions, 15 deletions
@@ -1,3 +1,5 @@  Move debug output into some debug function that can be enabled/disabled.  Automatically try new nicks if there's no more configured nicks to try (e.g. if foo is in use, try foo1, foo2, etc.) + +Don't replay logs for channels the user isn't currently in or clients will take JOINs/PARTs literally, plus channel info will be missing. diff --git a/blabouncer.c b/blabouncer.c index ec972bc..a6a811a 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1157,7 +1157,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        break;      case SOURCE_CLIENT: // If message(s) were from a real IRC client        // PASS received?  User is trying to log in, check their password. -      if (strncmp(tokens[0], "PASS", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "PASS", strlen(tokens[0])) == 0) {          if (checkpassword(tokens[1], settings->conffile)) {            printf("Password accepted!  Setting fd %d to authenticated.\n", sourcefd);            // Find the client in the clients array and set them as authenticated @@ -1202,7 +1202,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // USER received?  If so, assume this is a new client connecting and catch them on up on the state -      if (strncmp(tokens[0], "USER", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "USER", strlen(tokens[0])) == 0) {          // Somewhere to store the several strings we will need to build and send          char outgoingmsg[MAXDATASIZE]; // String to send to client @@ -1318,7 +1318,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Client PING received?  If so, send a PONG back with the next element as the argument. -      if (strncmp(tokens[0], "PING", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "PING", strlen(tokens[0])) == 0) {          printf("Client PING found and it is: %s with length %zd!  Sending response...\n", tokens[0], strlen(tokens[0]));          char outgoingmsg[MAXDATASIZE]; // String to send to client @@ -1334,14 +1334,14 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // TODO - Ignoring CAP for now so as not to confuse other clients, but we should probably query the server then relay the response to the client -      if (strncmp(tokens[0], "CAP", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "CAP", strlen(tokens[0])) == 0) {          printf("Client CAP found and it is: %s with length %zd!  Ignoring completely for now - TODO - do something useful!\n", tokens[0], strlen(tokens[0]));          free(strcopyPtr);          return 1;        }        // Just send NICK to server and let it change all clients' nicks if needed -      if (strncmp(tokens[0], "NICK", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "NICK", strlen(tokens[0])) == 0) {          printf("Client NICK found and it is: %s with length %zd!  Sending to server...\n", tokens[0], strlen(tokens[0]));          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);          free(strcopyPtr); @@ -1349,7 +1349,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // If PRIVMSG received, send to server, but also reformat and send to all other clients and log to replay file. -      if (strncmp(tokens[0], "PRIVMSG", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "PRIVMSG", strlen(tokens[0])) == 0) {          printf("Client PRIVMSG found and it is: %s with length %zd!  Sending to server then back to other clients...\n", tokens[0], strlen(tokens[0]));          // Send original request straight to server          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings); @@ -1379,7 +1379,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Just send JOIN to server and let it talk back to clients as required -      if (strncmp(tokens[0], "JOIN", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "JOIN", strlen(tokens[0])) == 0) {          printf("Client JOIN found and it is: %s with length %zd!  Sending to server...\n", tokens[0], strlen(tokens[0]));          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);          free(strcopyPtr); @@ -1388,7 +1388,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        // Don't do anything with QUIT, just let the client go - TODO: Let another clients know with a NOTICE or something        // A client has QUIT, so disconnect (close) them and don't do anything else for now - TODO: Let another clients know with a NOTICE or something -      if (strncmp(tokens[0], "QUIT", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "QUIT", strlen(tokens[0])) == 0) {          printf("Client QUIT found from fd %d and it is: %s with length %zd!  Disconnecting that fd.\n", sourcefd, tokens[0], strlen(tokens[0]));          disconnectclient(sourcefd, clients, ircdstrings, settings);          free(strcopyPtr); @@ -1396,7 +1396,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Just send PART to server and let it talk back to clients as required -      if (strncmp(tokens[0], "PART", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "PART", strlen(tokens[0])) == 0) {          printf("Client PART found and it is: %s with length %zd!  Sending to server...\n", tokens[0], strlen(tokens[0]));          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);          free(strcopyPtr); @@ -1404,7 +1404,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Just send TOPIC to server and let it talk back to clients as required -      if (strncmp(tokens[0], "TOPIC", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "TOPIC", strlen(tokens[0])) == 0) {          printf("Client TOPIC found and it is: %s with length %zd!  Sending to server...\n", tokens[0], strlen(tokens[0]));          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);          free(strcopyPtr); @@ -1413,7 +1413,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        // Take note of what sort of MODE was requested, mark the client as waiting for the reply (so not all clients get it)        // Send it to the server either way and let it talk back to the requesting client as required -      if (strncmp(tokens[0], "MODE", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "MODE", strlen(tokens[0])) == 0) {          printf("Client MODE found and it is: %s with length %zd!  Analysing...\n", tokens[0], strlen(tokens[0]));          // Is it a ban MODE request (MODE #channel b)?          if (counter >= 3 && strncmp(tokens[2], "b", strlen("b")) == 0) { @@ -1432,7 +1432,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // WHO requested, mark the client as waiting for the reply (so not all clients get it) and send it on the server -      if (strncmp(tokens[0], "WHO", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "WHO", strlen(tokens[0])) == 0) {          printf("Client WHO found and it is: %s with length %zd!  Marking as pending.\n", tokens[0], strlen(tokens[0]));          clients[arrindex(clients, sourcefd)].pendingwho = 1; @@ -1443,7 +1443,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // LIST requested, mark the client as waiting for the reply (so not all clients get it) and send it on the server -      if (strncmp(tokens[0], "LIST", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "LIST", strlen(tokens[0])) == 0) {          printf("Client LIST found and it is: %s with length %zd!  Marking as pending.\n", tokens[0], strlen(tokens[0]));          clients[arrindex(clients, sourcefd)].pendinglist = 1; @@ -1454,7 +1454,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Client WHOIS received, send straight on to server and mark the client as pending the response -      if (strncmp(tokens[0], "WHOIS", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "WHOIS", strlen(tokens[0])) == 0) {          printf("Client WHOIS found and it is: %s with length %zd!  Sending to server and setting client as pending.\n", tokens[0], strlen(tokens[0]));          clients[arrindex(clients, sourcefd)].pendingwhois = 1;          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings); @@ -1463,7 +1463,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli        }        // Client WHOWAS received, send straight on to server and mark the client as pending the response -      if (strncmp(tokens[0], "WHOWAS", strlen(tokens[0])) == 0) { +      if (strncasecmp(tokens[0], "WHOWAS", strlen(tokens[0])) == 0) {          printf("Client WHOWAS found and it is: %s with length %zd!  Sending to server and setting client as pending.\n", tokens[0], strlen(tokens[0]));          clients[arrindex(clients, sourcefd)].pendingwhowas = 1;          sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings);  | 
