X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chgident.cpp;h=95bf84e9ac873958b275a827fd8e470ef56f4255;hb=46e56dedd37abe33af4e8b970d5b83729dc1ef05;hp=82c34457a73451f5f7400fd596c5e66f88fb227d;hpb=8a5a800a87e657247bc619fbc669ba40f6bafc79;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 82c34457a..95bf84e9a 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * InspIRCd: (C) 2002-2010 InspIRCd Development Team * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see @@ -20,9 +20,9 @@ class CommandChgident : public Command { public: - CommandChgident (InspIRCd* Instance) : Command(Instance,"CHGIDENT", "o", 2) + CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) { - this->source = "m_chgident.so"; + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -37,12 +37,6 @@ class CommandChgident : public Command return CMD_FAILURE; } - if (parameters[1].empty()) - { - user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick.c_str()); - return CMD_FAILURE; - } - if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax) { user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str()); @@ -55,28 +49,35 @@ class CommandChgident : public Command return CMD_FAILURE; } - dest->ChangeIdent(parameters[1].c_str()); + if (IS_LOCAL(dest)) + { + dest->ChangeIdent(parameters[1].c_str()); - if (!ServerInstance->ULine(user->server)) - ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(dest) ? 'a' : 'A', "%s used CHGIDENT to change %s's ident to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str()); + if (!ServerInstance->ULine(user->server)) + ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGIDENT to change %s's ident to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str()); + } - /* route it! */ return CMD_SUCCESS; } + + RouteDescriptor GetRouting(User* user, const std::vector& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; class ModuleChgIdent : public Module { - CommandChgident* mycommand; - + CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me) + ModuleChgIdent() : cmd(this) { - mycommand = new CommandChgident(ServerInstance); - ServerInstance->AddCommand(mycommand); - + ServerInstance->AddCommand(&cmd); } virtual ~ModuleChgIdent() @@ -85,7 +86,7 @@ public: virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Provides support for the CHGIDENT command", VF_OPTCOMMON | VF_VENDOR); } };