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 * ---------------------------------------------------
24 #include "helperfuncs.h"
26 /* $ModDesc: Provides support for the SETHOST command */
30 void handle_sethost(char **parameters, int pcnt, userrec *user)
32 for (unsigned int x = 0; x < strlen(parameters[0]); x++)
34 if (((tolower(parameters[0][x]) < 'a') || (tolower(parameters[0][x]) > 'z')) && (parameters[0][x] != '.'))
36 if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-'))
38 Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
43 Srv->ChangeHost(user,parameters[0]);
44 Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0]));
48 class ModuleSetHost : public Module
51 ModuleSetHost(Server* Me)
55 Srv->AddCommand("SETHOST",handle_sethost,'o',1,"m_sethost.so");
58 virtual ~ModuleSetHost()
62 virtual Version GetVersion()
64 return Version(1,0,0,1,VF_VENDOR);
69 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
71 class ModuleSetHostFactory : public ModuleFactory
74 ModuleSetHostFactory()
78 ~ModuleSetHostFactory()
82 virtual Module * CreateModule(Server* Me)
84 return new ModuleSetHost(Me);
90 extern "C" void * init_module( void )
92 return new ModuleSetHostFactory;