3 #include "helperfuncs.h"
6 /* $ModDesc: Provides support for the SETIDENT command */
9 extern InspIRCd* ServerInstance;
11 class cmd_setident : public command_t
14 cmd_setident() : command_t("SETIDENT", 'o', 1)
16 this->source = "m_setident.so";
17 syntax = "<new-ident>";
20 void Handle(const char** parameters, int pcnt, userrec *user)
22 for(unsigned int x = 0; x < strlen(parameters[0]); x++)
24 if(((parameters[0][x] >= 'A') && (parameters[0][x] <= '}')) || strchr(".-0123456789", parameters[0][x]))
27 user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
31 ServerInstance->WriteOpers("%s used SETIDENT to change their ident from '%s' to '%s'", user->nick, user->ident, parameters[0]);
32 strlcpy(user->ident, parameters[0], IDENTMAX+2);
37 class ModuleSetIdent : public Module
39 cmd_setident* mycommand;
42 ModuleSetIdent(Server* Me) : Module::Module(Me)
45 mycommand = new cmd_setident();
46 Srv->AddCommand(mycommand);
49 virtual ~ModuleSetIdent()
53 virtual Version GetVersion()
55 return Version(1,0,0,0,VF_VENDOR);
60 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
62 class ModuleSetIdentFactory : public ModuleFactory
65 ModuleSetIdentFactory()
69 ~ModuleSetIdentFactory()
73 virtual Module * CreateModule(Server* Me)
75 return new ModuleSetIdent(Me);
81 extern "C" void * init_module( void )
83 return new ModuleSetIdentFactory;