summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-08 16:53:03 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-08 16:53:03 +0000
commit80a4db3cb0c7085f451433cf38506db2eb68a1a9 (patch)
tree0c5035ce710a4b5d99713999843b0f74d3d57ef0 /src/modules
parentd0646a9b10ee279c8932542657fb320b39face65 (diff)
Prepare to rename this, change it's purpose from quitban to connect ban (was I smoking crack?)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9663 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_quitban.cpp32
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();
}
};