#include "inspircd.h"
#include "xline.h"
-/* $ModDesc: Throttles the connections of IP ranges who try to connect flood. */
-
class ModuleConnectBan : public Module
{
clonemap connects;
{
// Create zline for set duration.
ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Your IP range has been attempting to connect too many times in too short a duration. Wait a while, and you will be able to connect.", mask.str());
- if (ServerInstance->XLines->AddLine(zl,NULL))
- ServerInstance->XLines->ApplyLines();
- else
+ if (!ServerInstance->XLines->AddLine(zl, NULL))
+ {
delete zl;
-
+ return;
+ }
+ ServerInstance->XLines->ApplyLines();
std::string maskstr = mask.str();
std::string timestr = ServerInstance->TimeString(zl->expiry);
ServerInstance->SNO->WriteGlobalSno('x',"Module m_connectban added Z:line on *@%s to expire on %s: Connect flooding",
void OnGarbageCollect()
{
- ServerInstance->Logs->Log("m_connectban", LOG_DEBUG, "Clearing map.");
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Clearing map.");
connects.clear();
}
};