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 * ---------------------------------------------------
16 /* $ModDesc: Provides support for the CHGNAME command */
20 class cmd_chgname : public command_t
23 cmd_chgname (InspIRCd* Instance) : command_t(Instance,"CHGNAME", 'o', 2)
25 this->source = "m_chgname.so";
26 syntax = "<nick> <newname>";
27 TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
30 CmdResult Handle(const char** parameters, int pcnt, userrec *user)
32 userrec* dest = ServerInstance->FindNick(parameters[0]);
36 user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
42 user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);
46 if (strlen(parameters[1]) > MAXGECOS)
48 user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);
54 dest->ChangeName(parameters[1]);
55 ServerInstance->WriteOpers("%s used CHGNAME to change %s's real name to '%s'", user->nick, dest->nick, dest->fullname);
56 return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */
65 class ModuleChgName : public Module
67 cmd_chgname* mycommand;
71 ModuleChgName(InspIRCd* Me) : Module(Me)
73 mycommand = new cmd_chgname(ServerInstance);
74 ServerInstance->AddCommand(mycommand);
77 virtual ~ModuleChgName()
81 virtual Version GetVersion()
83 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
88 MODULE_INIT(ModuleChgName)