Forward port NICKLEN feature from 2.10.11.
[ircu2.10.12-pk.git] / ircd / m_nick.c
index ef31e88c7f486784a8f63088b222f8e6c6e790ee..e7b08f793afb1ea4f041b3fd1039eee770476f12 100644 (file)
@@ -96,6 +96,7 @@
 #include "s_misc.h"
 #include "s_user.h"
 #include "send.h"
+#include "sys.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -163,8 +164,8 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * garbage
    */
   arg = parv[1];
-  if (strlen(arg) > NICKLEN)
-    arg[NICKLEN] = '\0';
+  if (strlen(arg) > IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN)))
+    arg[IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN))] = '\0';
 
   if ((s = strchr(arg, '~')))
     *s = '\0';
@@ -318,7 +319,7 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * creation) then reject it. If from a server and we reject it,
    * and KILL it. -avalon 4/4/92
    */
-  if (strlen(nick) != do_nick_name(nick))
+  if (!do_nick_name(nick) || strcmp(nick, parv[1]))
   {
     send_reply(sptr, ERR_ERRONEUSNICKNAME, parv[1]);