1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for the CHGNAME command */
20 class CommandChgname : public Command
23 CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2)
26 syntax = "<nick> <newname>";
27 TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
30 CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
32 User* dest = ServerInstance->FindNick(parameters[0]);
36 user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str());
40 if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
42 user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());
48 dest->ChangeName(parameters[1].c_str());
49 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());
55 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
57 User* dest = ServerInstance->FindNick(parameters[0]);
59 return ROUTE_OPT_UCAST(dest->server);
60 return ROUTE_LOCALONLY;
65 class ModuleChgName : public Module
70 ModuleChgName() : cmd(this)
72 ServerInstance->AddCommand(&cmd);
75 virtual ~ModuleChgName()
79 virtual Version GetVersion()
81 return Version("Provides support for the CHGNAME command", VF_OPTCOMMON | VF_VENDOR);
86 MODULE_INIT(ModuleChgName)