5 #include "helperfuncs.h"
7 /* $ModDesc: Provides support for the CHGIDENT command */
9 class cmd_chgident : public command_t
13 cmd_chgident(Server* serv) : command_t("CHGIDENT", 'o', 2)
15 this->source = "m_chgident.so";
17 syntax = "<nick> <newident>";
20 void Handle(const char** parameters, int pcnt, userrec *user)
22 userrec* dest = Srv->FindNick(std::string(parameters[0]));
26 if(!isident(parameters[1]))
28 user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
32 WriteOpers("%s used CHGIDENT to change %s's ident from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]);
33 strlcpy(dest->ident, parameters[1], IDENTMAX+2);
37 user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
43 class ModuleChgIdent : public Module
45 cmd_chgident* mycommand;
48 ModuleChgIdent(Server* Me) : Module::Module(Me)
50 mycommand = new cmd_chgident(Me);
51 Me->AddCommand(mycommand);
54 virtual ~ModuleChgIdent()
58 virtual Version GetVersion()
60 return Version(1,0,0,0,VF_VENDOR);
65 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
67 class ModuleChgIdentFactory : public ModuleFactory
70 ModuleChgIdentFactory()
74 ~ModuleChgIdentFactory()
78 virtual Module * CreateModule(Server* Me)
80 return new ModuleChgIdent(Me);
86 extern "C" void * init_module( void )
88 return new ModuleChgIdentFactory;