X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chghost.cpp;h=c327d27b32631780a54f8f665c2ac34714777738;hb=8e89fe75f9467969bce1dc6930befc6ef273edf6;hp=e13dc1c311116c73e2b20f42719f9ead20b541f0;hpb=b669f920eaa9fb795d0a103d724943898a0df4b2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index e13dc1c31..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 @@ -22,16 +22,16 @@ class CommandChghost : public Command private: char* hostmap; public: - CommandChghost (InspIRCd* Instance, char* hmap) : Command(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, User *user) + CmdResult Handle(const std::vector ¶meters, User *user) { - const char * x = parameters[1]; + const char * x = parameters[1].c_str(); for (; *x; x++) { @@ -41,13 +41,13 @@ class CommandChghost : public Command 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; @@ -56,14 +56,14 @@ class CommandChghost : public Command 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! */ @@ -84,12 +84,10 @@ class ModuleChgHost : public Module OnRehash(NULL,""); 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(User* user, const std::string ¶meter) { @@ -110,7 +108,7 @@ class ModuleChgHost : public Module Version GetVersion() { - return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); + return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } };