1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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 ConfigTagList tags = ServerInstance->Config->ConfTags("vhost");
31 for(ConfigIter i = tags.first; i != tags.second; ++i)
33 ConfigTag* tag = i->second;
34 std::string mask = tag->getString("host");
35 std::string username = tag->getString("user");
36 std::string pass = tag->getString("pass");
37 std::string hash = tag->getString("hash");
39 if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash))
43 user->WriteServ("NOTICE "+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
61 ModuleVHost() : cmd(this)
63 ServerInstance->AddCommand(&cmd);
66 virtual ~ModuleVHost()
71 virtual Version GetVersion()
73 return Version("Provides masking of user hostnames via traditional /VHOST command",VF_VENDOR);
78 MODULE_INIT(ModuleVHost)