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_geoclass.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/m_geoclass.cpp') diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp index 9f190b1c9..c57073cc5 100644 --- a/src/modules/m_geoclass.cpp +++ b/src/modules/m_geoclass.cpp @@ -36,9 +36,9 @@ public: { } - ModResult OnSetConnectClass(LocalUser* user, const ConnectClass::Ptr& myclass) override + ModResult OnPreChangeConnectClass(LocalUser* user, const std::shared_ptr& klass) override { - const std::string country = myclass->config->getString("country"); + const std::string country = klass->config->getString("country"); if (country.empty()) return MOD_RES_PASSTHRU; @@ -58,8 +58,8 @@ public: // A list of country codes were specified but the user didn't match // any of them. - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the origin country (%s) is not any of %s", - myclass->GetName().c_str(), code.c_str(), country.c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the origin country (%s) is not any of %s.", + klass->GetName().c_str(), code.c_str(), country.c_str()); return MOD_RES_DENY; } -- cgit v1.3.1-10-gc9f91