diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_quitban.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/modules/m_quitban.cpp b/src/modules/m_quitban.cpp index 7cd5742d8..a1ff0816c 100644 --- a/src/modules/m_quitban.cpp +++ b/src/modules/m_quitban.cpp @@ -14,18 +14,18 @@ #include "inspircd.h" #include "xline.h" -/* $ModDesc: Throttles the connections of any users who try quitflood the server */ +/* $ModDesc: Throttles the connections of any users who try connect flood */ class ModuleQuitBan : public Module { private: - clonemap quits; + clonemap connects; unsigned int threshold; unsigned int banduration; public: ModuleQuitBan(InspIRCd* Me) : Module(Me) { - Implementation eventlist[] = { I_OnUserDisconnect, I_OnGarbageCollect, I_OnRehash }; + Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); OnRehash(NULL, ""); } @@ -44,12 +44,12 @@ class ModuleQuitBan : public Module ConfigReader Conf(ServerInstance); std::string duration; - threshold = Conf.ReadInteger("quitban", "threshold", 0, true); + threshold = Conf.ReadInteger("connectban", "threshold", 0, true); if (threshold == 0) threshold = 10; - duration = Conf.ReadValue("quitban", "duration", 0, true); + duration = Conf.ReadValue("connectban", "duration", 0, true); if (duration.empty()) duration = "10m"; @@ -57,39 +57,39 @@ class ModuleQuitBan : public Module banduration = ServerInstance->Duration(duration); } - virtual void OnUserDisconnect(User *u) + virtual void OnUserConnect(User *u) { - clonemap::iterator i = quits.find(u->GetIPString()); + clonemap::iterator i = connects.find(u->GetIPString()); - if (i != quits.end()) + if (i != connects.end()) { i->second++; - ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Count for IP is now %d", i->second); + ServerInstance->Logs->Log("m_connectban",DEBUG, "Count for IP is now %d", i->second); if (i->second >= threshold) { // Create zline for set duration. - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Quit flooding", u->GetIPString()); + ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Connect flooding", u->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) ServerInstance->XLines->ApplyLines(); else delete zl; - ServerInstance->SNO->WriteToSnoMask('x', "Quit flooding from IP %s (%d)", u->GetIPString(), threshold); - quits.erase(i); + ServerInstance->SNO->WriteToSnoMask('x', "Connect flooding from IP %s (%d)", u->GetIPString(), threshold); + connects.erase(i); } } else { - quits[u->GetIPString()] = 1; - ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Added new record"); + connects[u->GetIPString()] = 1; + ServerInstance->Logs->Log("m_quitban",DEBUG, "Added new record"); } } virtual void OnGarbageCollect() { - ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Clearing map."); - quits.clear(); + ServerInstance->Logs->Log("m_quitban",DEBUG, "Clearing map."); + connects.clear(); } }; |