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";
19 void Handle(const char** parameters, int pcnt, userrec *user)
21 userrec* dest = Srv->FindNick(std::string(parameters[0]));
25 if(!isident(parameters[1]))
27 WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick);
31 WriteOpers("%s used CHGIDENT to change %s's ident from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]);
32 strlcpy(dest->ident, parameters[1], IDENTMAX+2);
36 WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, parameters[0]);
42 class ModuleChgIdent : public Module
44 cmd_chgident* mycommand;
47 ModuleChgIdent(Server* Me) : Module::Module(Me)
49 mycommand = new cmd_chgident(Me);
50 Me->AddCommand(mycommand);
53 virtual ~ModuleChgIdent()
57 virtual Version GetVersion()
59 return Version(1,0,0,0,VF_VENDOR);
64 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
66 class ModuleChgIdentFactory : public ModuleFactory
69 ModuleChgIdentFactory()
73 ~ModuleChgIdentFactory()
77 virtual Module * CreateModule(Server* Me)
79 return new ModuleChgIdent(Me);
85 extern "C" void * init_module( void )
87 return new ModuleChgIdentFactory;