From aae97bda3ea3452e8a6a3da82d3cfdf0adb8e038 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 2 May 2023 13:33:31 +0100 Subject: Add to limit cloaks to a specific connect class. --- include/modules/cloak.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include/modules') 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 classes; + protected: - Method(const Engine* engine) ATTR_NOT_NULL(2) + Method(const Engine* engine, const std::shared_ptr& 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: -- cgit v1.3.1-10-gc9f91