aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_delaymsg.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-03-11 14:27:32 +0000
committerGravatar Sadie Powell2022-03-11 14:52:56 +0000
commit2d329701db1d5c0361c018e088eb82c457f8ec7c (patch)
tree7897c5fcdf7eecb8c96bf31c030043d76574fa23 /src/modules/m_delaymsg.cpp
parentRefactor the opermodes module. (diff)
parentUse UCHAR_MAX instead of raw sizes in channames. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_delaymsg.cpp')
-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 af985e8da..1a59454d0 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 final
: public ParamMode<DelayMsgMode, IntExtItem>
@@ -57,6 +58,7 @@ class ModuleDelayMsg final
private:
DelayMsgMode djm;
bool allownotice;
+ CheckExemption::EventProvider exemptionprov;
ModResult HandleMessage(User* user, const MessageTarget& target, bool notice);
public:
@@ -64,6 +66,7 @@ public:
: Module(VF_VENDOR, "Adds channel mode d (delaymsg) which prevents newly joined users from speaking until the specified number of seconds have passed.")
, CTCTags::EventListener(this)
, djm(this)
+ , exemptionprov(this)
{
}
@@ -131,12 +134,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 %ld 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 %ld seconds.", len);
+ user->WriteNumeric(Numerics::CannotSendTo(channel, message));
+ return MOD_RES_DENY;
}
else
{