1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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 */
20 class CommandVhost : public Command
23 CommandVhost (InspIRCd* Instance) : Command(Instance,"VHOST", 0, 2)
25 this->source = "m_vhost.so";
26 syntax = "<username> <password>";
29 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
31 ConfigReader *Conf = new ConfigReader(ServerInstance);
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);
38 std::string hash = Conf->ReadValue("vhost","hash",index);
40 if ((!strcmp(parameters[0].c_str(),username.c_str())) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()))
44 user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
45 user->ChangeDisplayedHost(mask.c_str());
52 user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
58 class ModuleVHost : public Module
62 CommandVhost* mycommand;
65 ModuleVHost(InspIRCd* Me) : Module(Me)
67 mycommand = new CommandVhost(ServerInstance);
68 ServerInstance->AddCommand(mycommand);
72 virtual ~ModuleVHost()
77 virtual Version GetVersion()
79 return Version("$Id$",VF_VENDOR,API_VERSION);
84 MODULE_INIT(ModuleVHost)