]> arthur.barton.de Git - ngircd-alex.git/commitdiff
New 2nd message "Nickname too long" for error code 432
authorAlexander Barton <alex@barton.de>
Fri, 19 Aug 2011 09:09:40 +0000 (11:09 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 19 Aug 2011 09:09:40 +0000 (11:09 +0200)
src/ngircd/client.c
src/ngircd/messages.h

index 0f151ac8685469f83a8807682a72ddfd32a7ac9b..16c551f97a89b422bf356465f45b0cc85a522e11 100644 (file)
@@ -864,8 +864,13 @@ Client_CheckNick(CLIENT *Client, char *Nick)
        assert(Nick != NULL);
 
        if (!Client_IsValidNick(Nick)) {
-               IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
-                                  Client_ID(Client), Nick);
+               if (strlen(Nick ) >= Conf_MaxNickLength)
+                       IRC_WriteStrClient(Client, ERR_NICKNAMETOOLONG_MSG,
+                                          Client_ID(Client), Nick,
+                                          Conf_MaxNickLength - 1);
+               else
+                       IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
+                                          Client_ID(Client), Nick);
                return false;
        }
 
index 93bef3d78eb0ba033722136ce842a2518a077f5c..12791d23d3a4ed319e34910d27bc3a25cf333524 100644 (file)
 #define ERR_NOMOTD_MSG                 "422 %s :MOTD file is missing"
 #define ERR_NONICKNAMEGIVEN_MSG                "431 %s :No nickname given"
 #define ERR_ERRONEUSNICKNAME_MSG       "432 %s %s :Erroneous nickname"
+#define ERR_NICKNAMETOOLONG_MSG                "432 %s %s :Nickname too long, max. %u characters"
 #define ERR_NICKNAMEINUSE_MSG          "433 %s %s :Nickname already in use"
 #define ERR_USERNOTINCHANNEL_MSG       "441 %s %s %s :They aren't on that channel"
 #define ERR_NOTONCHANNEL_MSG           "442 %s %s :You are not on that channel"