3 #include "helperfuncs.h"
5 /* $ModDesc: Provides support for the SETIDENT command */
9 class cmd_setident : public command_t
12 cmd_setident() : command_t("SETIDENT", 'o', 1)
14 this->source = "m_setident.so";
15 syntax = "<new-ident>";
18 void Handle(const char** parameters, int pcnt, userrec *user)
20 for(unsigned int x = 0; x < strlen(parameters[0]); x++)
22 if(((parameters[0][x] >= 'A') && (parameters[0][x] <= '}')) || strchr(".-0123456789", parameters[0][x]))
25 WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick);
29 WriteOpers("%s used SETIDENT to change their ident from '%s' to '%s'", user->nick, user->ident, parameters[0]);
30 strlcpy(user->ident, parameters[0], IDENTMAX+2);
35 class ModuleSetIdent : public Module
37 cmd_setident* mycommand;
40 ModuleSetIdent(Server* Me) : Module::Module(Me)
43 mycommand = new cmd_setident();
44 Srv->AddCommand(mycommand);
47 virtual ~ModuleSetIdent()
51 virtual Version GetVersion()
53 return Version(1,0,0,0,VF_VENDOR);
58 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
60 class ModuleSetIdentFactory : public ModuleFactory
63 ModuleSetIdentFactory()
67 ~ModuleSetIdentFactory()
71 virtual Module * CreateModule(Server* Me)
73 return new ModuleSetIdent(Me);
79 extern "C" void * init_module( void )
81 return new ModuleSetIdentFactory;