diff options
Diffstat (limited to 'src/modules/m_messageflood.cpp')
-rw-r--r-- | src/modules/m_messageflood.cpp | 16 |
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); |