aboutsummaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-03-24 11:22:09 +0000
committerGravatar Sadie Powell2023-03-24 12:01:03 +0000
commit054fd8de79ea8b8b9b198e9511df990aea7bd9ff (patch)
treebb93e5a4c8af4df379cba3884f0a556071d04684 /src/users.cpp
parent[workflow] Fix misspell-fixer exceptions. (diff)
Allow modules to provide an error for when a class doesn't match.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 84ad1240f..646949b5a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -660,6 +660,7 @@ bool LocalUser::FindConnectClass()
ServerInstance->Logs.Debug("CONNECTCLASS", "Finding a connect class for {} ({}) ...",
uuid, GetRealMask());
+ std::optional<Numeric::Numeric> errnum;
for (const auto& klass : ServerInstance->Config->Classes)
{
ServerInstance->Logs.Debug("CONNECTCLASS", "Checking the {} connect class ...",
@@ -674,7 +675,7 @@ bool LocalUser::FindConnectClass()
}
ModResult modres;
- FIRST_MOD_RESULT(OnPreChangeConnectClass, modres, (this, klass));
+ FIRST_MOD_RESULT(OnPreChangeConnectClass, modres, (this, klass, errnum));
if (modres != MOD_RES_DENY)
{
ServerInstance->Logs.Debug("CONNECTCLASS", "The {} connect class is suitable for {} ({}).",
@@ -691,6 +692,9 @@ bool LocalUser::FindConnectClass()
connectclass->use_count--;
connectclass = nullptr;
}
+
+ if (errnum)
+ WriteNumeric(*errnum);
ServerInstance->Users.QuitUser(this, "You are not allowed to connect to this server");
return false;
}