diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-19 20:52:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-19 20:52:57 +0000 |
commit | fc8b284c2a3fcd3882c8d6c1eec4bd99f3e4c628 (patch) | |
tree | d717f5fd0d5981dafa2a6c727770e476ff16ed77 /src/modules/m_hostchange.cpp | |
parent | cf4439ac5c5e5f57aba2c998ee63b9b27ec17d69 (diff) |
Add <hostchange:ports> to the m_hostchange module to implement feature in bug #363
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7762 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_hostchange.cpp')
-rw-r--r-- | src/modules/m_hostchange.cpp | 24 |
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") |