1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
22 /* $ModDesc: Provides support for the SETHOST command */
26 class cmd_sethost : public command_t
29 cmd_sethost (InspIRCd* Instance) : command_t(Instance,"SETHOST",'o',1)
31 this->source = "m_sethost.so";
32 syntax = "<new-hostname>";
35 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
38 for (const char* x = parameters[0]; *x; x++, len++)
40 if (((tolower(*x) < 'a') || (tolower(*x) > 'z')) && (*x != '.'))
42 if (((*x < '0') || (*x> '9')) && (*x != '-'))
44 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
51 user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
54 if (user->ChangeDisplayedHost(parameters[0]))
56 ServerInstance->WriteOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
65 class ModuleSetHost : public Module
67 cmd_sethost* mycommand;
69 ModuleSetHost(InspIRCd* Me)
73 mycommand = new cmd_sethost(ServerInstance);
74 ServerInstance->AddCommand(mycommand);
77 virtual ~ModuleSetHost()
81 virtual Version GetVersion()
83 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
88 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
90 class ModuleSetHostFactory : public ModuleFactory
93 ModuleSetHostFactory()
97 ~ModuleSetHostFactory()
101 virtual Module * CreateModule(InspIRCd* Me)
103 return new ModuleSetHost(Me);
109 extern "C" void * init_module( void )
111 return new ModuleSetHostFactory;