X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chghost.cpp;h=727495932b41092641fe312792368a0cd7d166a7;hb=52acbb466b84a1cd161b1c111f855d6f0419fff3;hp=3d4d29f740b5c8f91b956fed882f8f1ca34e72c1;hpb=42d5b9571eff06b0c33093dc9118c29f9603fd2b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 3d4d29f74..727495932 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -11,14 +11,11 @@ * --------------------------------------------------- */ -#include -#include +#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; }