2 * CHGHOST module for InspIRCD
6 * Syntax: /CHGHOST [nick] [new name]
7 * Changes a users DHOST (oper only)
17 /* $ModDesc: Provides support for the CHGHOST command */
21 void handle_chghost(char **parameters, int pcnt, userrec *user)
23 for (int x = 0; x < strlen(parameters[1]); x++)
25 if (((tolower(parameters[1][x]) < 'a') || (tolower(parameters[1][x]) > 'z')) && (parameters[1][x] != '.'))
27 if (((parameters[1][x] < '0') || (parameters[1][x]> '9')) && (parameters[1][x] != '-'))
29 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
33 } userrec* dest = Srv->FindNick(std::string(parameters[0]));
36 Srv->ChangeHost(dest,parameters[1]);
37 Srv->SendOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+std::string(dest->nick)+" become "+std::string(parameters[1]));
42 class ModuleChgHost : public Module
48 Srv->AddCommand("CHGHOST",handle_chghost,'o',2);
51 virtual ~ModuleChgHost()
56 virtual Version GetVersion()
58 return Version(1,0,0,0);
63 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
65 class ModuleChgHostFactory : public ModuleFactory
68 ModuleChgHostFactory()
72 ~ModuleChgHostFactory()
76 virtual Module * CreateModule()
78 return new ModuleChgHost;
84 extern "C" void * init_module( void )
86 return new ModuleChgHostFactory;