X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chgident.cpp;h=b4cea8b43e122869590468ce20ec708350e25a0e;hb=b43fc66c17c2bef6dca66a966676b8128d5774ee;hp=58a06cbd8366104ed05439dc9b43e2d4ead3bdd8;hpb=24731c63b6320be22f7b3220236271fa7476b975;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 58a06cbd8..b4cea8b43 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -20,8 +20,9 @@ class CommandChgident : public Command { public: - CommandChgident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGIDENT", "o", 2) + CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) { + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -36,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()); @@ -54,14 +49,24 @@ 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; + } }; @@ -70,7 +75,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleChgIdent() : cmd(this) { ServerInstance->AddCommand(&cmd); } @@ -81,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); } };