diff options
| author | 2021-07-03 18:58:13 +0100 | |
|---|---|---|
| committer | 2021-07-03 19:00:12 +0100 | |
| commit | ea9a72c5a586517abc99412221bb1752f0b20b51 (patch) | |
| tree | 0b27ee4812d23182988bb5b5ab951e7c3dba9e37 /src/modules/m_hostchange.cpp | |
| parent | Move hostchange port parsing to a method in the HostRule class. (diff) | |
Allow hostchange to select users based on connect class.
Diffstat (limited to 'src/modules/m_hostchange.cpp')
| -rw-r--r-- | src/modules/m_hostchange.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 4a4317625..b0b3275e9 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -45,6 +45,7 @@ class HostRule private: HostChangeAction action; std::string host; + std::string klass; std::string mask; insp::flat_set<int> ports; std::string prefix; @@ -52,6 +53,9 @@ class HostRule void ReadConfig(ConfigTag* tag) { + // Parse <hostchange:class>. + klass = tag->getString("class"); + // Parse <hostchange:port>. const std::string portlist = tag->getString("ports"); if (!portlist.empty()) @@ -92,6 +96,9 @@ class HostRule bool Matches(LocalUser* user) const { + if (!klass.empty() && !stdalgo::string::equalsci(klass, user->MyClass->GetName())) + return false; + if (!ports.empty() && !ports.count(user->server_sa.port())) return false; |
