]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chgname.cpp
PROPAGATE this fix
[user/henk/code/inspircd.git] / src / modules / m_chgname.cpp
index 2e11715268d513f2a41dea5cfcdf8da9b6b4bd29..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,7 +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 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]);
@@ -69,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)