]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
A ton more clear() and empty() stuff thats been lingering on the long term todo for...
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index 3d4d29f740b5c8f91b956fed882f8f1ca34e72c1..727495932b41092641fe312792368a0cd7d166a7 100644 (file)
  * ---------------------------------------------------
  */
 
-#include <stdio.h>
-#include <string>
+#include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
 
-#include "inspircd.h"
-
 /* $ModDesc: Provides support for the CHGHOST command */
 
 /** Handle /CHGHOST
@@ -52,17 +49,22 @@ class cmd_chghost : public command_t
                        return CMD_FAILURE;
                }
                userrec* dest = ServerInstance->FindNick(parameters[0]);
-               if (dest)
+
+               if (!dest)
                {
-                       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 "+dest->dhost);
-                       }
-                       return CMD_SUCCESS;
+                       /* Drop it like a hot potato. XXX - we should probably message here.. -- w00t */
+                       return CMD_FAILURE;
                }
 
-               return CMD_FAILURE;
+               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 "+dest->dhost);
+               }
+
+               /* route it! */
+               return CMD_SUCCESS;
+
        }
 };
 
@@ -73,7 +75,7 @@ class ModuleChgHost : public Module
        char hostmap[256];
  public:
        ModuleChgHost(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                OnRehash(NULL,"");
                mycommand = new cmd_chghost(ServerInstance, hostmap);
@@ -100,7 +102,6 @@ class ModuleChgHost : public Module
 
        ~ModuleChgHost()
        {
-               delete[] hostmap;
        }
        
        Version GetVersion()
@@ -130,7 +131,7 @@ class ModuleChgHostFactory : public ModuleFactory
 };
 
 
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
 {
        return new ModuleChgHostFactory;
 }