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(Module* Creator) : Command(Creator,"VHOST", 2)
25 syntax = "<username> <password>";
28 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
30 ConfigReader *Conf = new ConfigReader;
32 for (int index = 0; index < Conf->Enumerate("vhost"); index++)
34 std::string mask = Conf->ReadValue("vhost","host",index);
35 std::string username = Conf->ReadValue("vhost","user",index);
36 std::string pass = Conf->ReadValue("vhost","pass",index);
37 std::string hash = Conf->ReadValue("vhost","hash",index);
39 if ((!strcmp(parameters[0].c_str(),username.c_str())) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()))
43 user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
44 user->ChangeDisplayedHost(mask.c_str());
51 user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
57 class ModuleVHost : public Module
63 ModuleVHost() : cmd(this)
65 ServerInstance->AddCommand(&cmd);
68 virtual ~ModuleVHost()
73 virtual Version GetVersion()
75 return Version("Provides masking of user hostnames via traditional /VHOST command",VF_VENDOR,API_VERSION);
80 MODULE_INIT(ModuleVHost)