]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chgname.cpp
Fix potential for duplicate SID if the SID is auto generated.
[user/henk/code/inspircd.git] / src / modules / m_chgname.cpp
index f3ea9cc25ad5a6a2e0d2f8294982123d24f94507..ddb38567f195c42fbffe490b767e278498f07054 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "modules.h"
 
 /* $ModDesc: Provides support for the CHGNAME command */
 
@@ -26,6 +24,7 @@ class cmd_chgname : public command_t
        {
                this->source = "m_chgname.so";
                syntax = "<nick> <newname>";
+               TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
        }
        
        CmdResult Handle(const char** parameters, int pcnt, userrec *user)
@@ -37,11 +36,19 @@ class cmd_chgname : public command_t
                        user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
                        return CMD_FAILURE;
                }
+               
                if (!*parameters[1])
                {
-                       user->WriteServ("NOTICE %s :*** GECOS is too short", user->nick);
+                       user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);
                        return CMD_FAILURE;
                }
+               
+               if (strlen(parameters[1]) > MAXGECOS)
+               {
+                       user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);
+                       return CMD_FAILURE;
+               }
+               
                if (IS_LOCAL(dest))
                {
                        dest->ChangeName(parameters[1]);
@@ -73,9 +80,9 @@ public:
        
        virtual Version GetVersion()
        {
-               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
+               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
        
 };
 
-MODULE_INIT(ModuleChgName);
+MODULE_INIT(ModuleChgName)