X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chghost.cpp;h=c327d27b32631780a54f8f665c2ac34714777738;hb=8e89fe75f9467969bce1dc6930befc6ef273edf6;hp=0ec88d7e1e11d74f27025e4c6917a41a044bb2a5;hpb=2b8ce39c6ea5e7a22fe39b21756f82051465f143;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 0ec88d7e1..c327d27b3 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -12,28 +12,26 @@ */ #include "inspircd.h" -#include "users.h" -#include "channels.h" -#include "modules.h" /* $ModDesc: Provides support for the CHGHOST command */ /** Handle /CHGHOST */ -class cmd_chghost : public command_t +class CommandChghost : public Command { private: char* hostmap; public: - cmd_chghost (InspIRCd* Instance, char* hmap) : command_t(Instance,"CHGHOST",'o',2), hostmap(hmap) + CommandChghost (InspIRCd* Instance, char* hmap) : Command(Instance,"CHGHOST","o",2), hostmap(hmap) { this->source = "m_chghost.so"; syntax = " "; + TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - CmdResult Handle(const char** parameters, int pcnt, userrec *user) + CmdResult Handle(const std::vector ¶meters, User *user) { - const char * x = parameters[1]; + const char * x = parameters[1].c_str(); for (; *x; x++) { @@ -43,29 +41,29 @@ class cmd_chghost : public command_t return CMD_FAILURE; } } - if (!*parameters[0]) + if (parameters[0].empty()) { user->WriteServ("NOTICE %s :*** CHGHOST: Host must be specified", user->nick); return CMD_FAILURE; } - if ((parameters[1] - x) > 63) + if ((parameters[1].c_str() - x) > 63) { user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick); return CMD_FAILURE; } - userrec* dest = ServerInstance->FindNick(parameters[0]); + User* dest = ServerInstance->FindNick(parameters[0]); if (!dest) { - user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0].c_str()); return CMD_FAILURE; } - if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->ULine(user->server))) + if ((dest->ChangeDisplayedHost(parameters[1].c_str())) && (!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); + ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost); } /* route it! */ @@ -77,23 +75,21 @@ class cmd_chghost : public command_t class ModuleChgHost : public Module { - cmd_chghost* mycommand; + CommandChghost* mycommand; char hostmap[256]; public: ModuleChgHost(InspIRCd* Me) : Module(Me) { OnRehash(NULL,""); - mycommand = new cmd_chghost(ServerInstance, hostmap); + mycommand = new CommandChghost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); + Implementation eventlist[] = { I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 1); } - void Implements(char* List) - { - List[I_OnRehash] = 1; - } - void OnRehash(userrec* user, const std::string ¶meter) + void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); std::string hmap = Conf.ReadValue("hostname", "charmap", 0); @@ -112,7 +108,7 @@ class ModuleChgHost : public Module Version GetVersion() { - return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION); + return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } };