summaryrefslogtreecommitdiff
path: root/src/coremods/core_xline/core_xline.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-20 16:34:03 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-20 16:34:03 +0200
commit02032ae28204264e6b7e161bac9cfd3042bab307 (patch)
treeca0b461a1aa11797d1a129df5048e4750d6256c7 /src/coremods/core_xline/core_xline.cpp
parent0e98ca83b5ed6a0f8ed5ec3a6ea80014cb6dea6c (diff)
Check Q-Lines on nick change in core_xline
Diffstat (limited to 'src/coremods/core_xline/core_xline.cpp')
-rw-r--r--src/coremods/core_xline/core_xline.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index 7daa70b49..7fa7da019 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -18,6 +18,7 @@
#include "inspircd.h"
+#include "xline.h"
#include "core_xline.h"
bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, const char* bantype, const char* confkey)
@@ -63,6 +64,26 @@ class CoreModXLine : public Module
{
}
+ ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE
+ {
+ // Check Q-Lines (for local nick changes only, remote servers have our Q-Lines to enforce themselves)
+
+ XLine* xline = ServerInstance->XLines->MatchesLine("Q", newnick);
+ if (!xline)
+ return MOD_RES_PASSTHRU; // No match
+
+ // A Q-Line matched the new nick, tell opers if the user is registered
+ if (user->registered == REG_ALL)
+ {
+ ServerInstance->SNO->WriteGlobalSno('a', "Q-Lined nickname %s from %s: %s",
+ newnick.c_str(), user->GetFullRealHost().c_str(), xline->reason.c_str());
+ }
+
+ // Send a numeric because if we deny then the core doesn't reply anything
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Invalid nickname: %s", newnick.c_str(), xline->reason.c_str());
+ return MOD_RES_DENY;
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the ELINE, GLINE, KLINE, QLINE, and ZLINE commands", VF_VENDOR|VF_CORE);