1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 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 * ---------------------------------------------------
27 /* $ModDesc: Provides support for the SETHOST command */
31 class cmd_sethost : public command_t
34 cmd_sethost (InspIRCd* Instance) : command_t(Instance,"SETHOST",'o',1)
36 this->source = "m_sethost.so";
37 syntax = "<new-hostname>";
40 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
43 for (const char* x = parameters[0]; *x; x++, len++)
45 if (((tolower(*x) < 'a') || (tolower(*x) > 'z')) && (*x != '.'))
47 if (((*x < '0') || (*x> '9')) && (*x != '-'))
49 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
56 user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
59 if (user->ChangeDisplayedHost(parameters[0]))
61 ServerInstance->WriteOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
70 class ModuleSetHost : public Module
72 cmd_sethost* mycommand;
74 ModuleSetHost(InspIRCd* Me)
78 mycommand = new cmd_sethost(ServerInstance);
79 ServerInstance->AddCommand(mycommand);
82 virtual ~ModuleSetHost()
86 virtual Version GetVersion()
88 return Version(1,0,0,1,VF_VENDOR,API_VERSION);
93 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
95 class ModuleSetHostFactory : public ModuleFactory
98 ModuleSetHostFactory()
102 ~ModuleSetHostFactory()
106 virtual Module * CreateModule(InspIRCd* Me)
108 return new ModuleSetHost(Me);
114 extern "C" void * init_module( void )
116 return new ModuleSetHostFactory;