]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
Added <oper:swhois> to m_swhois, which will override <type:swhois> if specified
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index d3c3dc84f8449719f1c64dad12764ecd53ebaccb..65a03b2315d04da61dba5363163f77951ce979c2 100644 (file)
@@ -21,13 +21,13 @@ using namespace std;
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-#include "helperfuncs.h"
+
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for the CHGHOST command */
 
-
-
+/** Handle /CHGHOST
+ */
 class cmd_chghost : public command_t
 {
  public:
@@ -37,7 +37,7 @@ class cmd_chghost : public command_t
                syntax = "<nick> <newhost>";
        }
         
-       void Handle(const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle(const char** parameters, int pcnt, userrec *user)
        {
                const char * x = parameters[1];
 
@@ -48,14 +48,14 @@ class cmd_chghost : public command_t
                                if (((*x < '0') || (*x > '9')) && (*x != '-'))
                                {
                                        user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
-                                       return;
+                                       return CMD_FAILURE;
                                }
                        }
                }
                if ((parameters[1] - x) > 63)
                {
                        user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick);
-                       return;
+                       return CMD_FAILURE;
                }
                userrec* dest = ServerInstance->FindNick(parameters[0]);
                if (dest)
@@ -63,9 +63,12 @@ class cmd_chghost : public command_t
                        if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->ULine(user->server)))
                        {
                                // fix by brain - ulines set hosts silently
-                               ServerInstance->WriteOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+parameters[1]);
+                               ServerInstance->WriteOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost);
                        }
+                       return CMD_SUCCESS;
                }
+
+               return CMD_FAILURE;
        }
 };
 
@@ -92,7 +95,7 @@ class ModuleChgHost : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,2,0,1,VF_VENDOR);
+               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
        }
        
 };