summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-12 20:34:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-12 20:34:34 +0000
commit0769519487fec4b024706d3d2ff665fc3d9401c6 (patch)
treed5588baa6431a366741f2168c2ec0a15334ce41b /src/modules
parentef70178ea465aebe7c5318496d4bde89f867bc3b (diff)
Only tick the timer when there are people doing /LIST, as suggested by special
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5461 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-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;
}