summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-22 02:19:38 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-22 02:19:38 +0000
commit2e44459aa65ddc93fe6e6ae83ee9120ab4c9cec1 (patch)
treeec246b553f0b56fa3d65a0f0f25887008368906e /src/modules
parent1d409d0f8b4f364bd8f34a477e673e8d03b3c075 (diff)
Fix for bug #332. Correctly invalidate old mode before updating it.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7400 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_messageflood.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 1f6f0cea7..b3d1090e1 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -151,15 +151,29 @@ class MsgFlood : public ModeHandler
}
else
{
- if (((nlines != f->lines) || (nsecs != f->secs)) && ((nsecs > 0) && (nlines > 0)) || (ban != f->ban))
+ std::string cur_param = channel->GetModeParameter('f');
+ parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs);
+ if (cur_param == parameter)
+ {
+ // mode params match
+ return MODEACTION_DENY;
+ }
+ else
{
- delete f;
- floodsettings *f = new floodsettings(ban,nsecs,nlines);
- parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs);
- channel->Shrink("flood");
- channel->Extend("flood",f);
- channel->SetModeParam('f', parameter.c_str(), true);
- return MODEACTION_ALLOW;
+ if (((nlines != f->lines) || (nsecs != f->secs)) && ((nsecs > 0) && (nlines > 0)) || (ban != f->ban))
+ {
+ delete f;
+ floodsettings *f = new floodsettings(ban,nsecs,nlines);
+ channel->Shrink("flood");
+ channel->Extend("flood",f);
+ channel->SetModeParam('f', cur_param.c_str(), false);
+ channel->SetModeParam('f', parameter.c_str(), true);
+ return MODEACTION_ALLOW;
+ }
+ else
+ {
+ return MODEACTION_DENY;
+ }
}
}
}