From 37fbbd840c89b1563157175642376873c56974b3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 7 May 2020 18:37:21 +0100 Subject: Add first class support for extbans. This replaces the previous support which was pretty much a giant hack and was not synchronised between servers. --- src/modules/m_nonotice.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/modules/m_nonotice.cpp') diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 9041c9932..b3e84755c 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -27,30 +27,24 @@ #include "inspircd.h" #include "modules/exemption.h" -#include "modules/isupport.h" +#include "modules/extban.h" -class ModuleNoNotice - : public Module - , public ISupport::EventListener +class ModuleNoNotice : public Module { private: + ExtBan::Acting extban; CheckExemption::EventProvider exemptionprov; SimpleChannelModeHandler nt; public: ModuleNoNotice() : Module(VF_VENDOR, "Adds channel mode T (nonotice) which allows channels to block messages sent with the /NOTICE command.") - , ISupport::EventListener(this) + , extban(this, "nonotice", 'T') , exemptionprov(this) , nt(this, "nonotice", 'T') { } - void OnBuildISupport(ISupport::TokenMap& tokens) override - { - tokens["EXTBAN"].push_back('T'); - } - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) override { if ((details.type == MSG_NOTICE) && (target.type == MessageTarget::TYPE_CHANNEL) && (IS_LOCAL(user))) @@ -67,7 +61,7 @@ class ModuleNoNotice return MOD_RES_DENY; } - if (c->GetExtBanStatus(user, 'T') == MOD_RES_DENY) + if (extban.GetStatus(user, c) == MOD_RES_DENY) { user->WriteNumeric(Numerics::CannotSendTo(c, "notices", 'T', "nonotice")); return MOD_RES_DENY; -- cgit v1.3.1-10-gc9f91