X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Ftimer.lua;h=fa1dd7c54cadde12e4bac4aa8a23304ba167bc96;hb=81c3f36b542816494b6181128cce9d34c8017760;hp=c52d9c68bb2ff81e2d093f9d55a0e6a3baa10f47;hpb=0c4c013e63da9965d97eee07125e9087b20da070;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