summaryrefslogtreecommitdiff
path: root/src/modules/m_delaymsg.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2012-07-04 10:32:06 -0700
committerAttila Molnar <attilamolnar@hush.com>2012-07-04 10:32:06 -0700
commit2d01e788b2d7d53200a711b4a5e388f454188def (patch)
tree204e2d894dc639f787c1671289a2a77ba6fb0178 /src/modules/m_delaymsg.cpp
parent7998173bcebb06e5e43e3337cc029eba3389199f (diff)
parentc3261196c2d129ec749cee8e27ad75a526d0087f (diff)
Merge pull request #241 from attilamolnar/insp20+delaymsgfix
[2.0] Fix MODE #chan +d being sent to users on a channel when a remote user joined a chan with +d on it
Diffstat (limited to 'src/modules/m_delaymsg.cpp')
-rw-r--r--src/modules/m_delaymsg.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index baa6355ad..1a0734ed9 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -18,14 +18,11 @@
#include "inspircd.h"
-#include <stdarg.h>
/* $ModDesc: Provides channelmode +d <int>, to deny messages to a channel until <int> seconds. */
class DelayMsgMode : public ModeHandler
{
- private:
- CUList empty;
public:
LocalIntExt jointime;
DelayMsgMode(Module* Parent) : ModeHandler(Parent, "delaymsg", 'd', PARAM_SETONLY, MODETYPE_CHANNEL)
@@ -55,7 +52,6 @@ class ModuleDelayMsg : public Module
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPreMessage};
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- ~ModuleDelayMsg();
Version GetVersion();
void OnUserJoin(Membership* memb, bool sync, bool created, CUList&);
ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list);
@@ -65,6 +61,9 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel
{
if (adding)
{
+ if ((channel->IsModeSet('d')) && (channel->GetModeParameter('d') == parameter))
+ return MODEACTION_DENY;
+
/* Setting a new limit, sanity check */
long limit = atoi(parameter.c_str());
@@ -90,10 +89,6 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel
return MODEACTION_ALLOW;
}
-ModuleDelayMsg::~ModuleDelayMsg()
-{
-}
-
Version ModuleDelayMsg::GetVersion()
{
return Version("Provides channelmode +d <int>, to deny messages to a channel until <int> seconds.", VF_VENDOR);
@@ -101,7 +96,7 @@ Version ModuleDelayMsg::GetVersion()
void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
{
- if (memb->chan->IsModeSet('d'))
+ if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet('d')))
{
djm.jointime.set(memb, ServerInstance->Time());
}
@@ -110,7 +105,7 @@ void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CULis
ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
/* Server origin */
- if (!user)
+ if ((!user) || (!IS_LOCAL(user)))
return MOD_RES_PASSTHRU;
if (target_type != TYPE_CHANNEL)
@@ -121,7 +116,7 @@ ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_ty
if (!memb)
return MOD_RES_PASSTHRU;
-
+
time_t ts = djm.jointime.get(memb);
if (ts == 0)