*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
+#include "wildcard.h"
/* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
public:
std::string action;
std::string newhost;
+ std::string ports;
};
typedef std::map<std::string,Host*> hostchanges_t;
hostchanges.clear();
for (int index = 0; index < Conf.Enumerate("hostchange"); index++)
{
- std::string mask = Conf.ReadValue("hostchange","mask",index);
- std::string action = Conf.ReadValue("hostchange","action",index);
- std::string newhost = Conf.ReadValue("hostchange","value",index);
+ std::string mask = Conf.ReadValue("hostchange", "mask", index);
+ std::string ports = Conf.ReadValue("hosthange", "ports", index);
+ std::string action = Conf.ReadValue("hostchange", "action", index);
+ std::string newhost = Conf.ReadValue("hostchange", "value", index);
Host* x = new Host;
x->action = action;
+ x->ports = ports;
x->newhost = newhost;
hostchanges[mask] = x;
}
{
for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
{
- if (ServerInstance->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first))
+ if (((match(user->MakeHost(),i->first.c_str(),true)) || (match(user->MakeHostIP(),i->first.c_str()))))
{
- Host* h = (Host*)i->second;
+ Host* h = i->second;
+
+ if (!h->ports.empty())
+ {
+ irc::portparser portrange(h->ports, false);
+ long portno = -1;
+ bool foundany = false;
+
+ while ((portno = portrange.GetToken()))
+ if (portno == user->GetPort())
+ foundany = true;
+
+ if (!foundany)
+ continue;
+ }
+
// host of new user matches a hostchange tag's mask
std::string newhost;
if (h->action == "set")