summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_hostchange.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index dc45a43d4..b2db6d004 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -25,6 +25,7 @@ class Host : public classbase
public:
std::string action;
std::string newhost;
+ std::string ports;
};
typedef std::map<std::string,Host*> hostchanges_t;
@@ -76,11 +77,13 @@ class ModuleHostChange : public Module
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;
}
@@ -100,6 +103,21 @@ class ModuleHostChange : public Module
if (ServerInstance->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first))
{
Host* h = (Host*)i->second;
+
+ if (!i->second->ports.empty())
+ {
+ irc::portparser portrange(i->second->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")