Forward port NICKLEN feature from 2.10.11.
authorMichael Poole <mdpoole@troilus.org>
Fri, 14 May 2004 13:17:08 +0000 (13:17 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 14 May 2004 13:17:08 +0000 (13:17 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1046 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
doc/example.conf
doc/readme.features
include/ircd_defs.h
include/ircd_features.h
include/supported.h
ircd/ircd_features.c
ircd/m_nick.c

index eebf019c8acc785af5b82bcda1ad62ddd8ed17e8..aa04a50a6e0756ee5e886aaea25ab73840c19dbd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,28 @@
+2004-05-14  Kevin L Mitchell  <klmitch@mit.edu>
+
+       [Original ChangeLog date: 2003-11-22 -MDP]
+
+       * ircd/m_nick.c (m_nick): truncate the nickname to the minimum of
+       the maximum allowed length (NICKLEN) or the allowed nickname
+       length specified as the NICKLEN feature
+
+       * ircd/ircd_features.c: declare NICKLEN and set its default value
+       to 9
+
+       * include/supported.h: add MAXNICKLEN to ISUPPORT and do a little
+       rearranging...
+
+       * include/ircd_features.h: add NICKLEN feature
+
+       * include/ircd_defs.h (NICKLEN): raise max NICKLEN to 15
+
+       * doc/readme.features: document new NICKLEN feature
+
+       * doc/example.conf: list new NICKLEN F-line
+
 2004-05-14  Matthias Crauwels <ultimate_@wol.be>
 
-       [Original ChangeLog date: 2003-06-08 -MP]
+       [Original ChangeLog date: 2003-06-08 -MDP]
        
        * ircd/gline.c: fixed the counting bug in gline_memory_count
  
index 38f9c2cccb2b2ad41f9848c0eb3f861d43977ccb..c3cabf2ea9b202443d7f69f0cdedfb8814607818 100644 (file)
@@ -722,6 +722,7 @@ features
 #  "HIDDEN_IP"="127.0.0.1";
 #  "KILLCHASETIMELIMIT"="30";
 #  "MAXCHANNELSPERUSER"="10";
+#  "NICKLEN" = "9";
 #  "AVBANLEN"="40";
 #  "MAXBANS"="30";
 #  "MAXSILES"="15";
index eb4c449723506a14c0080172c8ce427899f810e8..8752e1adfd5f5477865d4453a868e4774323ab1b 100644 (file)
@@ -1068,3 +1068,12 @@ URL_CLIENTS
  * Default: "ftp://ftp.undernet.org/pub/irc/clients"
 
 This defines a URL that users may visit to find compatible IRC clients.
+
+NICKLEN
+ * Type: integer
+ * Default: 9
+
+This is the allowed length of the nickname length.  It may not be
+larger than the NICKLEN #define, and should usually be the same
+length.  The real purpose of this feature is to permit easy increases
+in nickname length for a network.
index 14978fd8c74692fd37d5a2d1572dd67079d3ba68..f489f5c295373c646885069faf1c7139f34cdd3b 100644 (file)
  * is a default that can easily be overridden in CFLAGS.  Just add 
  * -DNICKLEN=15 to CFLAGS and save your config in .., and you can forget about
  * it.  Thanks for helping debug guys.
+ * See also F:NICKLEN in ircd.conf.
  */
 #ifndef NICKLEN
-#define NICKLEN         9
+#define NICKLEN         15
 #endif
 /*
  * USERLEN is the maximum length allowed of a user name including an optional
index 8f9606a27fa00288d5abdf9ceffd374cfd9396cc..22bd4906049be3138d7a40ad06c84fe2d9e6e109 100644 (file)
@@ -55,6 +55,7 @@ enum Feature {
   /* features that probably should not be touched */
   FEAT_KILLCHASETIMELIMIT,
   FEAT_MAXCHANNELSPERUSER,
+  FEAT_NICKLEN,
   FEAT_AVBANLEN,
   FEAT_MAXBANS,
   FEAT_MAXSILES,
index d875641bf3fc1694a0b6a7f36f8c07879236faa1..9e6f71ac3bb73b67326b6da229ad3e11193e7959 100644 (file)
@@ -43,6 +43,7 @@
                 " MAXCHANNELS=%i" \
                 " MAXBANS=%i" \
                 " NICKLEN=%i" \
+                " MAXNICKLEN=%i" \
                 " TOPICLEN=%i" \
                 " AWAYLEN=%i" \
                 " KICKLEN=%i"
@@ -55,8 +56,8 @@
 
 #define FEATURESVALUES1 feature_int(FEAT_MAXSILES), MAXMODEPARAMS, \
                        feature_int(FEAT_MAXCHANNELSPERUSER), \
-                       feature_int(FEAT_MAXBANS), NICKLEN, TOPICLEN, \
-                       AWAYLEN, TOPICLEN
+                        feature_int(FEAT_MAXBANS), feature_int(FEAT_NICKLEN), \
+                        NICKLEN, TOPICLEN, AWAYLEN, TOPICLEN
 
 #define FEATURESVALUES2 feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#", "(ov)@+", "b,k,l,imnpstrD", "rfc1459", \
                         feature_str(FEAT_NETWORK)
index dbdaa045372147dbf39875e8d33006a6dcb7bba7..8710d2d708a513456cd5b64ec694500078774d81 100644 (file)
@@ -261,6 +261,7 @@ static struct FeatureDesc {
   /* features that probably should not be touched */
   F_I(KILLCHASETIMELIMIT, 0, 30, 0),
   F_I(MAXCHANNELSPERUSER, 0, 10, 0),
+  F_I(NICKLEN, 0, 9, 0),
   F_I(AVBANLEN, 0, 40, 0),
   F_I(MAXBANS, 0, 45, 0),
   F_I(MAXSILES, 0, 15, 0),
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]);