summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_safelist.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 11976f91c..aebcc534e 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -136,24 +136,30 @@ class ListTimer : public InspTimer
}
}
- timer = new ListTimer(ServerInstance,1);
- ServerInstance->Timers->AddTimer(timer);
+ if (listusers.size())
+ {
+ timer = new ListTimer(ServerInstance,1);
+ ServerInstance->Timers->AddTimer(timer);
+ }
+ else
+ {
+ timer = NULL;
+ }
}
};
class ModuleSafeList : public Module
{
- private:
public:
ModuleSafeList(InspIRCd* Me) : Module::Module(Me)
{
- timer = new ListTimer(ServerInstance,1);
- ServerInstance->Timers->AddTimer(timer);
+ timer = NULL;
}
virtual ~ModuleSafeList()
{
- ServerInstance->Timers->DelTimer(timer);
+ if (timer)
+ ServerInstance->Timers->DelTimer(timer);
}
virtual Version GetVersion()
@@ -223,7 +229,13 @@ class ModuleSafeList : public Module
time_t* llt = new time_t;
*llt = ServerInstance->Time();
user->Extend("safelist_last", llt);
-
+
+ if (!timer)
+ {
+ timer = new ListTimer(ServerInstance,1);
+ ServerInstance->Timers->AddTimer(timer);
+ }
+
return 1;
}