1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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 (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGNAME", "o", 2, 2)
25 syntax = "<nick> <newname>";
26 TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
29 CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
31 User* dest = ServerInstance->FindNick(parameters[0]);
35 user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str());
39 if (parameters[1].empty())
41 user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick.c_str());
45 if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
47 user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());
53 dest->ChangeName(parameters[1].c_str());
54 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());
60 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
62 User* dest = ServerInstance->FindNick(parameters[0]);
64 return ROUTE_OPT_UCAST(dest->server);
65 return ROUTE_LOCALONLY;
70 class ModuleChgName : public Module
75 ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me, this)
77 ServerInstance->AddCommand(&cmd);
80 virtual ~ModuleChgName()
84 virtual Version GetVersion()
86 return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION);
91 MODULE_INIT(ModuleChgName)