1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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) : Command(Instance,"CHGNAME", "o", 2, 2)
25 this->source = "m_chgname.so";
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].empty())
42 user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick.c_str());
46 if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
48 user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());
54 dest->ChangeName(parameters[1].c_str());
55 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());
56 return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */
65 class ModuleChgName : public Module
67 CommandChgname* mycommand;
71 ModuleChgName(InspIRCd* Me) : Module(Me)
73 mycommand = new CommandChgname(ServerInstance);
74 ServerInstance->AddCommand(mycommand);
78 virtual ~ModuleChgName()
82 virtual Version GetVersion()
84 return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
89 MODULE_INIT(ModuleChgName)