X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chgname.cpp;h=86e01ad33cef16a9dbafca09aa8d78e32d28fed8;hb=95c1fb9bdd5f93cf4f8306a7b8ae9ca098aade1a;hp=3111da9cfc6ec111f3f7ff002cbd8605d1dc01f3;hpb=b6dbd6caab62bc2c0d11ce5a45d511611eb9c2ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 3111da9cf..86e01ad33 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -20,9 +20,9 @@ class CommandChgname : public Command { public: - CommandChgname (InspIRCd* Instance) : Command(Instance,"CHGNAME", "o", 2, 2) + CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) { - this->source = "m_chgname.so"; + flags_needed = 'o'; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -37,12 +37,6 @@ class CommandChgname : public Command return CMD_FAILURE; } - if (parameters[1].empty()) - { - user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick.c_str()); - return CMD_FAILURE; - } - if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos) { user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str()); @@ -52,27 +46,30 @@ class CommandChgname : public Command if (IS_LOCAL(dest)) { dest->ChangeName(parameters[1].c_str()); - ServerInstance->SNO->WriteToSnoMask('A', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->fullname.c_str()); - return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */ + ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->fullname.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 ModuleChgName : public Module { - CommandChgname* mycommand; - + CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me) + ModuleChgName() : cmd(this) { - mycommand = new CommandChgname(ServerInstance); - ServerInstance->AddCommand(mycommand); - + ServerInstance->AddCommand(&cmd); } virtual ~ModuleChgName() @@ -81,7 +78,7 @@ public: virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Provides support for the CHGNAME command", VF_OPTCOMMON | VF_VENDOR); } };