aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-05-02 13:33:31 +0100
committerGravatar Sadie Powell2023-05-02 13:33:31 +0100
commitaae97bda3ea3452e8a6a3da82d3cfdf0adb8e038 (patch)
treedc886c69e55910975f07766d49a6c550778328f6 /include
parentIPv6 addresses should be partially expanded with '0' not 0x0. (diff)
Add <cloak:class> to limit cloaks to a specific connect class.
Diffstat (limited to 'include')
-rw-r--r--include/modules/cloak.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/modules/cloak.h b/include/modules/cloak.h
index 2d3f41fd6..7a2d7d525 100644
--- a/include/modules/cloak.h
+++ b/include/modules/cloak.h
@@ -117,10 +117,25 @@ private:
/** The name of the engine that created this method. */
std::string provname;
+ /** The connect classes that a user can be in before */
+ insp::flat_set<std::string> classes;
+
protected:
- Method(const Engine* engine) ATTR_NOT_NULL(2)
+ Method(const Engine* engine, const std::shared_ptr<ConfigTag>& tag) ATTR_NOT_NULL(2)
: provname(engine->name)
{
+ irc::commasepstream klassstream(tag->getString("class"));
+ for (std::string klass; klassstream.GetToken(klass); )
+ classes.insert(klass);
+ }
+
+ bool MatchesUser(LocalUser* user) const
+ {
+ if (!classes.empty() && !stdalgo::isin(classes, user->GetClass()->GetName()))
+ return false;
+
+ // All fields matched.
+ return true;
}
public: