Scheduler: don't immediately execute commands when restoring repeated events.

This commit is contained in:
Daniel Folkinshteyn 2010-09-04 01:25:57 -04:00 committed by Valentin Lorentz
parent c6facc99f3
commit 4b1d2b49e4
2 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ class Scheduler(callbacks.Plugin):
event['time'], event['command'], n) event['time'], event['command'], n)
elif event['type'] == 'repeat': # repeating event elif event['type'] == 'repeat': # repeating event
self._repeat(ircobj, event['msg'], name, self._repeat(ircobj, event['msg'], name,
event['time'], event['command']) event['time'], event['command'], False)
except AssertionError, e: except AssertionError, e:
if str(e) == 'An event with the same name has already been scheduled.': if str(e) == 'An event with the same name has already been scheduled.':
# we must be reloading the plugin, event is still scheduled # we must be reloading the plugin, event is still scheduled
@ -162,9 +162,9 @@ class Scheduler(callbacks.Plugin):
irc.error(_('Invalid event id.')) irc.error(_('Invalid event id.'))
remove = wrap(remove, ['lowered']) remove = wrap(remove, ['lowered'])
def _repeat(self, irc, msg, name, seconds, command): def _repeat(self, irc, msg, name, seconds, command, now=True):
f = self._makeCommandFunction(irc, msg, command, remove=False) f = self._makeCommandFunction(irc, msg, command, remove=False)
id = schedule.addPeriodicEvent(f, seconds, name) id = schedule.addPeriodicEvent(f, seconds, name, now)
assert id == name assert id == name
self.events[name] = {'command':command, self.events[name] = {'command':command,
'msg':msg, 'msg':msg,

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+limnoria (2011-07-06T11:14:57+0200)' version = '0.83.4.1+limnoria (2011-07-07T13:31:50+0200)'