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 */
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 char** parameters, int pcnt, 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);
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());
51 user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
57 class ModuleVHost : public Module
61 CommandVhost* mycommand;
64 ModuleVHost(InspIRCd* Me) : Module(Me)
66 mycommand = new CommandVhost(ServerInstance);
67 ServerInstance->AddCommand(mycommand);
71 virtual ~ModuleVHost()
76 virtual Version GetVersion()
78 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
83 MODULE_INIT(ModuleVHost)