summaryrefslogtreecommitdiff
path: root/src/modules/m_messageflood.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-23 18:15:04 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-23 18:15:04 +0000
commit164998f1e6e2cb885fb4d630ded29ed5191218c8 (patch)
tree74236e203aafac2b96b0b35f30dc481452eea971 /src/modules/m_messageflood.cpp
parent2f1b4c7ce35651262f7903e801fd9428881ee05b (diff)
Patch from Namegduf converting all instances (where possible) of time() -> ServerInstance->Time(). Thanks!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10691 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_messageflood.cpp')
-rw-r--r--src/modules/m_messageflood.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index c374c5346..53df408f6 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -19,6 +19,8 @@
*/
class floodsettings : public classbase
{
+ private:
+ InspIRCd *ServerInstance;
public:
bool ban;
int secs;
@@ -26,10 +28,10 @@ class floodsettings : public classbase
time_t reset;
std::map<User*,int> counters;
- floodsettings() : ban(0), secs(0), lines(0) {};
- floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c)
+ floodsettings(InspIRCd *Instance) : ServerInstance(Instance), ban(0), secs(0), lines(0) {};
+ floodsettings(InspIRCd *Instance, bool a, int b, int c) : ServerInstance(Instance), ban(a), secs(b), lines(c)
{
- reset = time(NULL) + secs;
+ reset = ServerInstance->Time() + secs;
};
void addmessage(User* who)
@@ -43,10 +45,10 @@ class floodsettings : public classbase
{
counters[who] = 1;
}
- if (time(NULL) > reset)
+ if (ServerInstance->Time() > reset)
{
counters.clear();
- reset = time(NULL) + secs;
+ reset = ServerInstance->Time() + secs;
}
}
@@ -140,7 +142,7 @@ class MsgFlood : public ModeHandler
if (!channel->GetExt("flood", f))
{
parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs);
- floodsettings *fs = new floodsettings(ban,nsecs,nlines);
+ floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines);
channel->Extend("flood",fs);
channel->SetMode('f', true);
channel->SetModeParam('f', parameter.c_str(), true);
@@ -160,7 +162,7 @@ class MsgFlood : public ModeHandler
if ((((nlines != f->lines) || (nsecs != f->secs) || (ban != f->ban))) && (((nsecs > 0) && (nlines > 0))))
{
delete f;
- floodsettings *fs = new floodsettings(ban,nsecs,nlines);
+ floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines);
channel->Shrink("flood");
channel->Extend("flood",fs);
channel->SetModeParam('f', cur_param.c_str(), false);