X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Ftimer.lua;h=fa1dd7c54cadde12e4bac4aa8a23304ba167bc96;hb=2f3a9c1f031f043e3984488f0ec5affa53a2f2f3;hp=c52d9c68bb2ff81e2d093f9d55a0e6a3baa10f47;hpb=095d291f5356ff2450c11608fda6bdabc4286f91;p=prosody.git diff --git a/util/timer.lua b/util/timer.lua index c52d9c68..fa1dd7c5 100644 --- a/util/timer.lua +++ b/util/timer.lua @@ -1,6 +1,6 @@ -- Prosody IM --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. @@ -55,11 +55,12 @@ if not event then else local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1; function _add_task(delay, func) - event_base:addevent(nil, 0, function () + local event_handle; + event_handle = event_base:addevent(nil, 0, function () local ret = func(); if ret then return 0, ret; - else + elseif event_handle then return EVENT_LEAVE; end end