From 8831595e1a5306f4204fedc6ecbc4a3c9299fb35 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 8 Jan 2023 16:12:43 +0000 Subject: Rework how users are assigned to connect classes. - Move core connect class checks and to the core_user module. - Add pre-change and post-change events for when a connect class changes. - Split explicit class changing out into its own method. - Remove the need to almost always call CheckClass after SetClass. - Add use counting to the connect class instead of relying on the shared_ptr use count. --- src/modules/m_dnsbl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/modules/m_dnsbl.cpp') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 25154d5a2..e0d2d276d 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -504,17 +504,17 @@ public: } } - ModResult OnSetConnectClass(LocalUser* user, const ConnectClass::Ptr& myclass) override + ModResult OnPreChangeConnectClass(LocalUser* user, const std::shared_ptr& klass) override { - std::string dnsbl; - if (!myclass->config->readString("dnsbl", dnsbl)) + const std::string dnsbl = klass->config->getString("dnsbl"); + if (!dnsbl.empty()) return MOD_RES_PASSTHRU; MarkExtItem::List* match = data.markext.Get(user); if (!match) { - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires a DNSBL mark", - myclass->GetName().c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires a DNSBL mark.", + klass->GetName().c_str()); return MOD_RES_DENY; } @@ -525,8 +525,8 @@ public: } const std::string marks = stdalgo::string::join(dnsbl); - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the DNSBL marks (%s) do not match %s", - myclass->GetName().c_str(), marks.c_str(), dnsbl.c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the DNSBL marks (%s) do not match %s.", + klass->GetName().c_str(), marks.c_str(), dnsbl.c_str()); return MOD_RES_DENY; } -- cgit v1.3.1-10-gc9f91