diff options
| author | 2020-05-07 18:37:21 +0100 | |
|---|---|---|
| committer | 2020-05-07 21:41:04 +0100 | |
| commit | 37fbbd840c89b1563157175642376873c56974b3 (patch) | |
| tree | 35e7c27475241a6abd465338453b82312688a885 /src/modules/m_nonotice.cpp | |
| parent | Fix an oversight introduced in commit 98e4ddfb21. (diff) | |
Add first class support for extbans.
This replaces the previous support which was pretty much a giant
hack and was not synchronised between servers.
Diffstat (limited to 'src/modules/m_nonotice.cpp')
| -rw-r--r-- | src/modules/m_nonotice.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
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; |
