#include "users.h"
#include "modules.h"
-#include "helperfuncs.h"
+
#include "inspircd.h"
/* $ModDesc: Connection throttle */
int conns = 0, throttled = 0;
-extern time_t TIME;
-
-extern InspIRCd* ServerInstance;
class ModuleConnFlood : public Module
{
std::string quitmsg;
ConfigReader* conf;
- Server *Srv;
+
public:
- ModuleConnFlood(Server* Me) : Module::Module(Me)
+ ModuleConnFlood(InspIRCd* Me) : Module::Module(Me)
{
- Srv = Me;
+
InitConf();
}
void InitConf()
{
/* read configuration variables */
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
/* throttle configuration */
seconds = conf->ReadInteger("connflood", "seconds", 0, true);
maxconns = conf->ReadInteger("connflood", "maxconns", 0, true);
/* seconds to wait when the server just booted */
boot_wait = conf->ReadInteger("connflood", "bootwait", 0, true);
- first = TIME;
+ first = ServerInstance->Time();
}
virtual void OnUserRegister(userrec* user)
{
- time_t next = TIME;
+ time_t next = ServerInstance->Time();
if (!first)
first = next - boot_wait;
{
}
- virtual Module * CreateModule(Server* Me)
+ virtual Module * CreateModule(InspIRCd* Me)
{
return new ModuleConnFlood(Me);
}