]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
Annotations
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index ac16f137ee37d5389b18cbd229b30ec4cb9ad962..18853ac2dd1008b65f116144ad7aae10ebc03663 100644 (file)
@@ -21,7 +21,7 @@ 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 */
@@ -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,24 +48,27 @@ 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)
                {
-                       if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->is_uline(user->server)))
+                       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;
        }
 };