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 * ---------------------------------------------------
16 /* $ModDesc: Provides masking of user hostnames via traditional /VHOST command */
18 static ConfigReader* Conf;
22 class cmd_vhost : public command_t
25 cmd_vhost (InspIRCd* Instance) : command_t(Instance,"VHOST", 0, 2)
27 this->source = "m_vhost.so";
28 syntax = "<username> <password>";
31 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
33 for (int index = 0; index < Conf->Enumerate("vhost"); index++)
35 std::string mask = Conf->ReadValue("vhost","host",index);
36 std::string username = Conf->ReadValue("vhost","user",index);
37 std::string pass = Conf->ReadValue("vhost","pass",index);
39 if ((!strcmp(parameters[0],username.c_str())) && (!strcmp(parameters[1],pass.c_str())))
43 user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
44 user->ChangeDisplayedHost(mask.c_str());
50 user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
55 class ModuleVHost : public Module
62 ModuleVHost(InspIRCd* Me) : Module(Me)
65 Conf = new ConfigReader(ServerInstance);
66 mycommand = new cmd_vhost(ServerInstance);
67 ServerInstance->AddCommand(mycommand);
70 virtual ~ModuleVHost()
75 void Implements(char* List)
80 virtual void OnRehash(userrec* user, const std::string ¶meter)
83 Conf = new ConfigReader(ServerInstance);
86 virtual Version GetVersion()
88 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
93 MODULE_INIT(ModuleVHost)