diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2019-11-18 03:21:19 -0700 |
---|---|---|
committer | P. Powell <petpow@saberuk.com> | 2019-11-18 11:18:00 +0000 |
commit | 7ae4ca1a238ba7598ce2cd1b3de116cfc7a89588 (patch) | |
tree | fd9fae72d469aabcd249b2ccc59ee27ccbf840cb /src/modules/m_nonotice.cpp | |
parent | 36d7ee44a8c697a702211bb767d7a5c912300dfd (diff) |
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.
Diffstat (limited to 'src/modules/m_nonotice.cpp')
-rw-r--r-- | src/modules/m_nonotice.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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<Channel>(); - 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; |