diff options
author | Adam <Adam@anope.org> | 2013-01-21 02:31:28 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-01-21 02:31:28 -0500 |
commit | 846b56c72471f750279a0d60d07443e72f92592d (patch) | |
tree | 269e82926dee8bbb7f4f36f6b519769e96cd0357 /modules/commands/os_defcon.cpp | |
parent | e62d2fe56e0dbaa3b718b982d26146536f738db5 (diff) |
Fix defcon timeout timer
Diffstat (limited to 'modules/commands/os_defcon.cpp')
-rw-r--r-- | modules/commands/os_defcon.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index d878058e1..c5ee032bd 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -103,12 +103,22 @@ static Anope::string defconReverseModes(const Anope::string &modes); static ServiceReference<GlobalService> GlobalService("GlobalService", "Global"); +static Timer *timeout; + class DefConTimeout : public CallBack { int level; public: - DefConTimeout(Module *mod, int newlevel) : CallBack(mod, DConfig.timeout), level(newlevel) { } + DefConTimeout(Module *mod, int newlevel) : CallBack(mod, DConfig.timeout), level(newlevel) + { + timeout = this; + } + + ~DefConTimeout() + { + timeout = NULL; + } void Tick(time_t) anope_override { @@ -133,7 +143,6 @@ class DefConTimeout : public CallBack } } }; -static DefConTimeout *timeout; class CommandOSDefcon : public Command { @@ -196,11 +205,7 @@ class CommandOSDefcon : public Command FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(newLevel)); - if (timeout) - { - delete timeout; - timeout = NULL; - } + delete timeout; if (DConfig.timeout) timeout = new DefConTimeout(this->module, 5); |