From 65b0aa4d5feb8aaf90e60c654636f547ea047682 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 19:06:17 +0200 Subject: m_delaymsg Remove unused code --- src/modules/m_delaymsg.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index baa6355ad..c0ff09ccf 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -18,14 +18,11 @@ #include "inspircd.h" -#include /* $ModDesc: Provides channelmode +d , to deny messages to a channel until 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); @@ -90,10 +86,6 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel return MODEACTION_ALLOW; } -ModuleDelayMsg::~ModuleDelayMsg() -{ -} - Version ModuleDelayMsg::GetVersion() { return Version("Provides channelmode +d , to deny messages to a channel until seconds.", VF_VENDOR); @@ -121,7 +113,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) -- cgit v1.2.3 From edd159566de1cdae6f39302961a10e1800b0ff2c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 19:12:00 +0200 Subject: m_delaymsg Stop sending +d mode change to users when a remote user joins a channel with +d on it --- src/modules/m_delaymsg.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index c0ff09ccf..cc09629e3 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -61,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()); -- cgit v1.2.3 From c3261196c2d129ec749cee8e27ad75a526d0087f Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 19:18:38 +0200 Subject: m_delaymsg Don't bother with remote users --- src/modules/m_delaymsg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index cc09629e3..1a0734ed9 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -96,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()); } @@ -105,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) -- cgit v1.2.3