#include "inspircd_config.h"
-extern void do_log(int, const char*, ...);
-
class DLLManager
{
public:
chan_hash chanlist;
std::vector<userrec*> local_users;
DNS* Res;
+ TimerManager* Timers;
void AddServerName(const std::string &servername);
const char* FindServerNamePtr(const std::string &servername);
*/
virtual bool IsNick(const std::string &nick);
- /** Adds an InspTimer which will trigger at a future time
- */
- virtual void AddTimer(InspTimer* T);
-
/** Attempts to look up a nick and return a pointer to it.
* This function will return NULL if the nick does not exist.
*/
virtual void Tick(time_t TIME) = 0;
};
-void TickTimers(time_t TIME);
-void AddTimer(InspTimer* T);
-void TickMissedTimers(time_t TIME);
+class TimerManager : public Extensible
+{
+ protected:
+
+ typedef std::vector<InspTimer*> timergroup;
+ typedef std::map<time_t, timergroup*> timerlist;
+
+ private:
+
+ timerlist Timers;
+
+ public:
+ void TickTimers(time_t TIME);
+ void AddTimer(InspTimer* T);
+ void TickMissedTimers(time_t TIME);
+};
#endif
OpenLog(argv, argc);
this->stats = new serverstats();
this->Parser = new CommandParser();
+ this->Timers = new TimerManager();
Config->ClearStack();
Config->Read(true, NULL);
CheckRoot();
{
FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME));
}
- TickMissedTimers(TIME);
+ Timers->TickMissedTimers(TIME);
expire_run = true;
return;
}
if (process_module_sockets)
this->DoSocketTimeouts(TIME);
- TickTimers(TIME);
+ Timers->TickTimers(TIME);
/* Call the socket engine to wait on the active
* file descriptors. The socket engine has everything's
return NULL;
}
-void Server::AddTimer(InspTimer* T)
-{
- ::AddTimer(T);
-}
-
void Server::SendOpers(const std::string &s)
{
WriteOpers("%s",s.c_str());
extern time_t TIME;
+extern InspIRCd* ServerInstance;
+
class ListData : public classbase
{
public:
}
ListTimer* MyTimer = new ListTimer(1,Srv);
- Srv->AddTimer(MyTimer);
+ ServerInstance->Timers->AddTimer(MyTimer);
}
};
Srv = Me;
MyTimer = new ListTimer(1,Srv);
- Srv->AddTimer(MyTimer);
+ ServerInstance->Timers->AddTimer(MyTimer);
}
virtual ~ModuleSafeList()
#include "helperfuncs.h"
#include "timer.h"
-typedef std::vector<InspTimer*> timergroup;
-typedef std::map<time_t, timergroup*> timerlist;
-
-timerlist Timers;
-
-void TickTimers(time_t TIME)
+void TimerManager::TickTimers(time_t TIME)
{
timerlist::iterator found = Timers.find(TIME);
* If you move your clock BACK, and your timers move further ahead as a result,
* then tough titty you'll just have to wait.
*/
-void TickMissedTimers(time_t TIME)
+void TimerManager::TickMissedTimers(time_t TIME)
{
for (time_t n = TIME-1; n > TIME-120; n--)
{
}
}
-void AddTimer(InspTimer* T)
+void TimerManager::AddTimer(InspTimer* T)
{
timergroup* x = NULL;
x->push_back(T);
}
+