aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_account.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-10-18 11:17:03 +0100
committerGravatar Sadie Powell2022-10-18 11:17:03 +0100
commit101e12833dd825f59b249396515b1410eb699557 (patch)
tree3514ee5c3bed4e305b39c80403d07f426f11c1cd /src/modules/m_account.cpp
parentHandle renamed modules when reading the modules to load. (diff)
Allow requiring users to be logged into their nick for requireaccount.
Diffstat (limited to 'src/modules/m_account.cpp')
-rw-r--r--src/modules/m_account.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/modules/m_account.cpp b/src/modules/m_account.cpp
index dd696f5fa..9c042e439 100644
--- a/src/modules/m_account.cpp
+++ b/src/modules/m_account.cpp
@@ -340,10 +340,22 @@ public:
ModResult OnSetConnectClass(LocalUser* user, ConnectClass::Ptr myclass) override
{
- if (myclass->config->getBool("requireaccount") && !accountapi.GetAccountName(user))
+ const char* error = nullptr;
+ if (stdalgo::string::equalsci(myclass->config->getString("requireaccount"), "nick"))
{
- ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into an account",
- myclass->GetName().c_str());
+ if (!accountapi.GetAccountName(user) && !accountapi.IsIdentifiedToNick(user))
+ error = "an account matching their current nickname";
+ }
+ else if (myclass->config->getBool("requireaccount"))
+ {
+ if (!accountapi.GetAccountName(user))
+ error = "an account";
+ }
+
+ if (error)
+ {
+ ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into %s",
+ myclass->GetName().c_str(), error);
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;