5 #include "helperfuncs.h"
8 /* $ModDesc: Provides support for the CHGIDENT command */
10 extern InspIRCd* ServerInstance;
12 class cmd_chgident : public command_t
16 cmd_chgident(Server* serv) : command_t("CHGIDENT", 'o', 2)
18 this->source = "m_chgident.so";
20 syntax = "<nick> <newident>";
23 void Handle(const char** parameters, int pcnt, userrec *user)
25 userrec* dest = ServerInstance->FindNick(parameters[0]);
29 if(!isident(parameters[1]))
31 user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
35 ServerInstance->WriteOpers("%s used CHGIDENT to change %s's ident from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]);
36 strlcpy(dest->ident, parameters[1], IDENTMAX+2);
40 user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
46 class ModuleChgIdent : public Module
48 cmd_chgident* mycommand;
51 ModuleChgIdent(Server* Me) : Module::Module(Me)
53 mycommand = new cmd_chgident(Me);
54 Me->AddCommand(mycommand);
57 virtual ~ModuleChgIdent()
61 virtual Version GetVersion()
63 return Version(1,0,0,0,VF_VENDOR);
68 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
70 class ModuleChgIdentFactory : public ModuleFactory
73 ModuleChgIdentFactory()
77 ~ModuleChgIdentFactory()
81 virtual Module * CreateModule(Server* Me)
83 return new ModuleChgIdent(Me);
89 extern "C" void * init_module( void )
91 return new ModuleChgIdentFactory;