]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index 82a94fadc82b581700952a4e90c37ae403bf1708..fdb438c91a2eaebcd2711b2f6f8f4da6a9e676b9 100644 (file)
@@ -21,16 +21,17 @@ 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 */
 
-static Server *Srv;
+
 
 class cmd_chghost : public command_t
 {
  public:
      cmd_chghost () : command_t("CHGHOST",'o',2)
cmd_chghost (InspIRCd* Instance) : command_t(Instance,"CHGHOST",'o',2)
        {
                this->source = "m_chghost.so";
                syntax = "<nick> <newhost>";
@@ -56,14 +57,13 @@ class cmd_chghost : public command_t
                        user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick);
                        return;
                }
-               userrec* dest = Srv->FindNick(std::string(parameters[0]));
+               userrec* dest = ServerInstance->FindNick(parameters[0]);
                if (dest)
                {
-                       Srv->ChangeHost(dest,parameters[1]);
-                       if (!Srv->IsUlined(user->server))
+                       if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->ULine(user->server)))
                        {
                                // fix by brain - ulines set hosts silently
-                               Srv->SendOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+std::string(dest->nick)+" become "+std::string(parameters[1]));
+                               ServerInstance->WriteOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+parameters[1]);
                        }
                }
        }
@@ -74,12 +74,12 @@ class ModuleChgHost : public Module
 {
        cmd_chghost* mycommand;
  public:
-       ModuleChgHost(Server* Me)
+       ModuleChgHost(InspIRCd* Me)
                : Module::Module(Me)
        {
-               Srv = Me;
-               mycommand = new cmd_chghost();
-               Srv->AddCommand(mycommand);
+               
+               mycommand = new cmd_chghost(ServerInstance);
+               ServerInstance->AddCommand(mycommand);
        }
 
        void Implements(char* List)
@@ -110,7 +110,7 @@ class ModuleChgHostFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule(Server* Me)
+       virtual Module * CreateModule(InspIRCd* Me)
        {
                return new ModuleChgHost(Me);
        }