1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
25 /* $ModDesc: Provides support for the CHGHOST command */
29 void handle_chghost(char **parameters, int pcnt, userrec *user)
31 for (unsigned int x = 0; x < strlen(parameters[1]); x++)
33 if (((tolower(parameters[1][x]) < 'a') || (tolower(parameters[1][x]) > 'z')) && (parameters[1][x] != '.'))
35 if (((parameters[1][x] < '0') || (parameters[1][x]> '9')) && (parameters[1][x] != '-'))
37 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
41 } userrec* dest = Srv->FindNick(std::string(parameters[0]));
44 Srv->ChangeHost(dest,parameters[1]);
45 Srv->SendOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+std::string(dest->nick)+" become "+std::string(parameters[1]));
50 class ModuleChgHost : public Module
56 Srv->AddCommand("CHGHOST",handle_chghost,'o',2,"m_chghost.so");
59 virtual ~ModuleChgHost()
64 virtual Version GetVersion()
66 return Version(1,0,0,1,VF_VENDOR);
71 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
73 class ModuleChgHostFactory : public ModuleFactory
76 ModuleChgHostFactory()
80 ~ModuleChgHostFactory()
84 virtual Module * CreateModule()
86 return new ModuleChgHost;
92 extern "C" void * init_module( void )
94 return new ModuleChgHostFactory;