summaryrefslogtreecommitdiff
path: root/include/timers.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-03-30 23:38:40 -0500
committerAdam <Adam@anope.org>2013-03-30 23:39:43 -0500
commit7e7556f06445d4d8e607ef514c9fb5009899db73 (patch)
treefde8e4e7c59f40183e215cd69ce0d042670b24b9 /include/timers.h
parent111d6a917806fd3ce2269436d08d68bd7eb1d5ea (diff)
Merge usefulness of Timer and CallBack classes into Timer, and fix it to really work
Diffstat (limited to 'include/timers.h')
-rw-r--r--include/timers.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/timers.h b/include/timers.h
index 229333596..a0b04efa2 100644
--- a/include/timers.h
+++ b/include/timers.h
@@ -18,6 +18,10 @@
class CoreExport Timer
{
private:
+ /** The owner of the timer, if any
+ */
+ Module *owner;
+
/** The time this was created
*/
time_t settime;
@@ -42,6 +46,14 @@ class CoreExport Timer
*/
Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
+ /** Constructor, initializes the triggering time
+ * @param creator The creator of the timer
+ * @param time_from_now The number of seconds from now to trigger the timer
+ * @param now The time now
+ * @param repeating Repeat this timer every time_from_now if this is true
+ */
+ Timer(Module *creator, long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
+
/** Destructor, removes the timer from the list
*/
virtual ~Timer();
@@ -76,6 +88,11 @@ class CoreExport Timer
*/
time_t GetSetTime() const;
+ /** Returns the owner of this timer, if any
+ * @return The owner of the timer
+ */
+ Module *GetOwner() const;
+
/** Called when the timer ticks
* This should be overridden with something useful
*/
@@ -106,6 +123,10 @@ class CoreExport TimerManager
* @param ctime The current time
*/
static void TickTimers(time_t ctime = Anope::CurTime);
+
+ /** Deletes all timers owned by the given module
+ */
+ static void DeleteTimersFor(Module *m);
};
#endif // TIMERS_H