diff options
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 28 |
1 files changed, 9 insertions, 19 deletions
@@ -627,43 +627,33 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int debugprint(DEBUG_SOME, "Server 432 (ERR_ERRONEUSNICKNAME) or 433 (ERR_NICKNAMEINUSE) found and it is: %s with length %zd! Trying another nick...\n", tokens[1], strlen(tokens[1])); - // Try to get nick2 and nick3 from the configuration file - char nick2[MAXNICKLENGTH]; - char nick3[MAXNICKLENGTH]; - if (!getconfstr("nick2", settings->conffile, nick2)) { - nick2[0] = '\0'; - } - if (!getconfstr("nick3", settings->conffile, nick3)) { - nick3[0] = '\0'; - } - // Do we have both a nick2 and a nick3? (And not tried autonick yet.) - if (nick2[0] && nick3[0] && !ircdstate->autonicknum) { + if (settings->ircnick2[0] && settings->ircnick3[0] && !ircdstate->autonicknum) { // Has nick3 already been tried? - if (strncmp(ircdstate->ircnick, nick3, strlen(settings->ircnick)) == 0) { + if (strncmp(ircdstate->ircnick, settings->ircnick3, strlen(settings->ircnick)) == 0) { // Then try autonick tryautonick(ircdstate); // Has nick2 already been tried? - } else if (strncmp(ircdstate->ircnick, nick2, strlen(settings->ircnick)) == 0) { + } else if (strncmp(ircdstate->ircnick, settings->ircnick2, strlen(settings->ircnick)) == 0) { // Then try nick3 debugprint(DEBUG_SOME, "Trying nick3, nick2 was already tried.\n"); - strcpy(ircdstate->ircnick, nick3); + strcpy(ircdstate->ircnick, settings->ircnick3); // Have neither been tried? } else { // Then try nick2 debugprint(DEBUG_SOME, "Trying nick2, nick3 is also configured.\n"); - strcpy(ircdstate->ircnick, nick2); + strcpy(ircdstate->ircnick, settings->ircnick2); } // Do we only have a nick2? (And not tried autonick yet.) - } else if (nick2[0] && !ircdstate->autonicknum) { + } else if (settings->ircnick2[0] && !ircdstate->autonicknum) { // Has it already been tried? - if (strncmp(ircdstate->ircnick, nick2, strlen(settings->ircnick)) == 0) { + if (strncmp(ircdstate->ircnick, settings->ircnick2, strlen(settings->ircnick)) == 0) { // Then try autonick tryautonick(ircdstate); } else { // Then try it debugprint(DEBUG_SOME, "Trying nick2, nick3 is not configured.\n"); - strcpy(ircdstate->ircnick, nick2); + strcpy(ircdstate->ircnick, settings->ircnick2); } // Do we have neither? (Or have already started autonick.) } else { @@ -740,7 +730,7 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int struct channel *channels, struct settings *settings, char tokens[MAXTOKENS][MAXDATASIZE], int counter) { // PASS received? User is trying to log in, check their password. if (strncasecmp(tokens[0], "PASS", strlen(tokens[0])) == 0) { - if (checkpassword(tokens[1], settings->conffile)) { + if (checkpassword(tokens[1], settings)) { debugprint(DEBUG_FULL, "Password accepted! Setting fd %d to authenticated.\n", sourcefd); // Find the client in the clients array and set them as authenticated for (int i = 0; i < MAXCLIENTS; i++) { |