1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 * ---------------------------------------------------
18 /* $ModDesc: Provides support for the CHGNAME command */
22 class cmd_chgname : public command_t
25 cmd_chgname (InspIRCd* Instance) : command_t(Instance,"CHGNAME", 'o', 2)
27 this->source = "m_chgname.so";
28 syntax = "<nick> <newname>";
31 CmdResult Handle(const char** parameters, int pcnt, userrec *user)
33 userrec* dest = ServerInstance->FindNick(parameters[0]);
37 user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
43 user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);
47 if (strlen(parameters[1]) > MAXGECOS)
49 user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);
55 dest->ChangeName(parameters[1]);
56 ServerInstance->WriteOpers("%s used CHGNAME to change %s's real name to '%s'", user->nick, dest->nick, dest->fullname);
57 return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */
66 class ModuleChgName : public Module
68 cmd_chgname* mycommand;
72 ModuleChgName(InspIRCd* Me) : Module(Me)
74 mycommand = new cmd_chgname(ServerInstance);
75 ServerInstance->AddCommand(mycommand);
78 virtual ~ModuleChgName()
82 virtual Version GetVersion()
84 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
89 MODULE_INIT(ModuleChgName)