aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar iwalkalone2022-02-13 15:54:47 +0100
committerGravatar GitHub2022-02-13 14:54:47 +0000
commit5027a63e52f4fb65cbd210ba8f5f44a397c2de96 (patch)
treeb9323fe804b0fd2d0863bf1fff84c1324840190f /src/modules
parentAdd an option to allow channel ops to enable the permchannels mode. (diff)
Change delaymsg to use exemptchanops and have an oper priv (#1959).
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_delaymsg.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index 27e2c3e40..b860bfe07 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -22,6 +22,7 @@
#include "inspircd.h"
#include "modules/ctctags.h"
+#include "modules/exemption.h"
class DelayMsgMode : public ParamMode<DelayMsgMode, LocalIntExt>
{
@@ -56,12 +57,14 @@ class ModuleDelayMsg
private:
DelayMsgMode djm;
bool allownotice;
+ CheckExemption::EventProvider exemptionprov;
ModResult HandleMessage(User* user, const MessageTarget& target, bool notice);
public:
ModuleDelayMsg()
: CTCTags::EventListener(this)
, djm(this)
+ , exemptionprov(this)
{
}
@@ -139,12 +142,16 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target,
if ((ts + len) > ServerInstance->Time())
{
- if (channel->GetPrefixValue(user) < VOICE_VALUE)
- {
- const std::string message = InspIRCd::Format("You cannot send messages to this channel until you have been a member for %d seconds.", len);
- user->WriteNumeric(Numerics::CannotSendTo(channel, message));
- return MOD_RES_DENY;
- }
+ ModResult res = CheckExemption::Call(exemptionprov, user, channel, "delaymsg");
+ if (res == MOD_RES_ALLOW)
+ return MOD_RES_PASSTHRU;
+
+ if (user->HasPrivPermission("channels/ignore-delaymsg"))
+ return MOD_RES_PASSTHRU;
+
+ const std::string message = InspIRCd::Format("You cannot send messages to this channel until you have been a member for %d seconds.", len);
+ user->WriteNumeric(Numerics::CannotSendTo(channel, message));
+ return MOD_RES_DENY;
}
else
{