From 7ae4ca1a238ba7598ce2cd1b3de116cfc7a89588 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Mon, 18 Nov 2019 03:21:19 -0700 Subject: Split the channel mode and extban replies. Tell the user when they are extbanned rather than incorrectly say that the channel mode is set. Refactored the logic in m_nonotice to match that of the others. --- src/modules/m_nonotice.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/modules/m_nonotice.cpp') diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 730b02716..2883a3c6d 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -41,20 +41,20 @@ class ModuleNoNotice : public Module ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE { - ModResult res; if ((details.type == MSG_NOTICE) && (target.type == MessageTarget::TYPE_CHANNEL) && (IS_LOCAL(user))) { Channel* c = target.Get(); - if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet(nt))) + + ModResult res = CheckExemption::Call(exemptionprov, user, c, "nonotice"); + if (res == MOD_RES_ALLOW) + return MOD_RES_PASSTHRU; + + bool modeset = c->IsModeSet(nt); + if (!c->GetExtBanStatus(user, 'T').check(!modeset)) { - res = CheckExemption::Call(exemptionprov, user, c, "nonotice"); - if (res == MOD_RES_ALLOW) - return MOD_RES_PASSTHRU; - else - { - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, "Can't send NOTICE to channel (+T is set)"); - return MOD_RES_DENY; - } + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, InspIRCd::Format("Can't send NOTICE to channel (%s)", + modeset ? "+T is set" : "you're extbanned")); + return MOD_RES_DENY; } } return MOD_RES_PASSTHRU; -- cgit v1.2.3