]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_setident.cpp
Made SANICK not collide the user (theres no need to in the new 1.1 now we have return...
[user/henk/code/inspircd.git] / src / modules / m_setident.cpp
index a5eb27a9b06cbfb5ca6a6242fb29e28b7c924b0d..c3b24aeb495c13e5f5a008e09d18cfa8f9f62486 100644 (file)
@@ -1,21 +1,23 @@
 #include "users.h"
 #include "modules.h"
-#include "helperfuncs.h"
+
+#include "inspircd.h"
 
 /* $ModDesc: Provides support for the SETIDENT command */
 
-static Server *Srv;
+
+
 
 class cmd_setident : public command_t
 {
  public:
      cmd_setident() : command_t("SETIDENT", 'o', 1)
cmd_setident (InspIRCd* Instance) : command_t(Instance,"SETIDENT", 'o', 1)
        {
                this->source = "m_setident.so";
                syntax = "<new-ident>";
        }
 
-       void Handle(const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle(const char** parameters, int pcnt, userrec *user)
        {
                for(unsigned int x = 0; x < strlen(parameters[0]); x++)
                {
@@ -23,11 +25,13 @@ class cmd_setident : public command_t
                                continue;
                        
                        user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
-                       return;
+                       return CMD_FAILURE;
                }
                
-               WriteOpers("%s used SETIDENT to change their ident from '%s' to '%s'", user->nick, user->ident, parameters[0]);
-               strlcpy(user->ident, parameters[0], IDENTMAX+2);
+               ServerInstance->WriteOpers("%s used SETIDENT to change their ident from '%s' to '%s'", user->nick, user->ident, parameters[0]);
+               user->ChangeIdent(parameters[0]);
+
+               return CMD_SUCCESS;
        }
 };
 
@@ -37,11 +41,11 @@ class ModuleSetIdent : public Module
        cmd_setident*   mycommand;
        
  public:
-       ModuleSetIdent(Server* Me) : Module::Module(Me)
+       ModuleSetIdent(InspIRCd* Me) : Module::Module(Me)
        {
-               Srv = Me;
-               mycommand = new cmd_setident();
-               Srv->AddCommand(mycommand);
+               
+               mycommand = new cmd_setident(ServerInstance);
+               ServerInstance->AddCommand(mycommand);
        }
        
        virtual ~ModuleSetIdent()
@@ -68,7 +72,7 @@ class ModuleSetIdentFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule(Server* Me)
+       virtual Module * CreateModule(InspIRCd* Me)
        {
                return new ModuleSetIdent(Me);
        }