2 * SETHOST module for InspIRCD
6 * Syntax: /SETHOST [new host]
7 * Changes the user's DHOST who issues the command
18 /* $ModDesc: Provides support for the SETHOST command */
22 void handle_sethost(char **parameters, int pcnt, userrec *user)
24 for (int x = 0; x < strlen(parameters[0]); x++)
26 if (((tolower(parameters[0][x]) < 'a') || (tolower(parameters[0][x]) > 'z')) && (parameters[0][x] != '.'))
28 if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-'))
30 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
35 Srv->ChangeHost(user,parameters[0]);
36 Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0]));
40 class ModuleSetHost : public Module
46 Srv->AddCommand("SETHOST",handle_sethost,'o',1);
49 virtual ~ModuleSetHost()
54 virtual Version GetVersion()
56 return Version(1,0,0,0);
61 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
63 class ModuleSetHostFactory : public ModuleFactory
66 ModuleSetHostFactory()
70 ~ModuleSetHostFactory()
74 virtual Module * CreateModule()
76 return new ModuleSetHost;
82 extern "C" void * init_module( void )
84 return new ModuleSetHostFactory;