summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6279a01)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3301
e03df62e-2008-0410-955e-
edbf42e46eb7
*/
virtual int CountUsers(chanrec* c);
*/
virtual int CountUsers(chanrec* c);
+ /** 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.
*/
/** 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) {}
};
virtual void Tick(time_t TIME) {}
};
+void TickTimers(time_t TIME);
+void AddTimer(InspTimer* T);
#include "socket.h"
#include "typedefs.h"
#include "command_parse.h"
#include "socket.h"
#include "typedefs.h"
#include "command_parse.h"
InspIRCd* ServerInstance;
InspIRCd* ServerInstance;
if (TIME < OLDTIME)
WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
DoBackgroundUserStuff(TIME);
if (TIME < OLDTIME)
WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
DoBackgroundUserStuff(TIME);
+
+ /*
+ * Trigger all InspTimers that are pending
+ */
+ TickTimers(TIME);
}
/* Process timeouts on module sockets each time around
}
/* Process timeouts on module sockets each time around
#include "typedefs.h"
#include "modules.h"
#include "command_parse.h"
#include "typedefs.h"
#include "modules.h"
#include "command_parse.h"
extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
+void Server::AddTimer(InspTimer* T)
+{
+ AddTimer(T);
+}
+
void Server::SendOpers(std::string s)
{
WriteOpers("%s",s.c_str());
void Server::SendOpers(std::string s)
{
WriteOpers("%s",s.c_str());
typedef std::vector<userrec *> UserList;
typedef std::vector<userrec *> UserList;
+class ListTimer : public InspTimer
+{
+ private:
+ Server* Srv;
+ public:
+ ListTimer(long interval, Server* Me) : InspTimer(interval), Server(Me)
+ {
+ }
+
+ Tick(time_t TIME)
+ {
+ log(DEBUG,"*** Timer tick!");
+ MyTimer = new ListTimer(1);
+ Srv->AddTimer(MyTimer);
+ }
+};
+
class ModuleSafeList : public Module
{
private:
Server *Srv;
class ModuleSafeList : public Module
{
private:
Server *Srv;
UserList listusers; /* vector of people doing a /list */
public:
ModuleSafeList(Server* Me) : Module::Module(Me)
{
Srv = Me;
UserList listusers; /* vector of people doing a /list */
public:
ModuleSafeList(Server* Me) : Module::Module(Me)
{
Srv = Me;
+
+ MyTimer = new ListTimer(1);
+ Srv->AddTimer(MyTimer,Me);
}
virtual ~ModuleSafeList()
}
virtual ~ModuleSafeList()