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 CHGIDENT command */
20 class CommandChgident : public Command
23 CommandChgident (InspIRCd* Instance) : Command(Instance,"CHGIDENT", "o", 2)
25 this->source = "m_chgident.so";
26 syntax = "<nick> <newident>";
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 :*** CHGIDENT: Ident must be specified", user->nick.c_str());
46 if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax)
48 user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str());
52 if (!ServerInstance->IsIdent(parameters[1].c_str()))
54 user->WriteServ("NOTICE %s :*** CHGIDENT: Invalid characters in ident", user->nick.c_str());
58 dest->ChangeIdent(parameters[1].c_str());
60 if (!ServerInstance->ULine(user->server))
61 ServerInstance->SNO->WriteToSnoMask('A', "%s used CHGIDENT to change %s's ident to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str());
69 class ModuleChgIdent : public Module
71 CommandChgident* mycommand;
75 ModuleChgIdent(InspIRCd* Me) : Module(Me)
77 mycommand = new CommandChgident(ServerInstance);
78 ServerInstance->AddCommand(mycommand);
82 virtual ~ModuleChgIdent()
86 virtual Version GetVersion()
88 return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
93 MODULE_INIT(ModuleChgIdent)