diff options
author | mathieui <mathieui@mathieui.net> | 2013-03-08 22:53:35 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-03-08 22:53:35 +0100 |
commit | 9885203c6799c121f5bc8a733dc1937fe8c1b4d6 (patch) | |
tree | 4190635a7c9c78d2dce1a4c8357ccb887f12b8af /plugins/reminder.py | |
parent | dbde08a5267cf003d8a4a9c16f5b18275e9a4bd1 (diff) | |
download | poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.gz poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.bz2 poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.xz poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.zip |
Update the plugins to use the PluginAPI
Also:
- Add get_conversation_messages() to PluginAPI
- Make plugins_autoload colon-separated instead of space-separated
(for consistency)
- Replace a JID() with a safeJID() in the uptime plugin
Diffstat (limited to 'plugins/reminder.py')
-rw-r--r-- | plugins/reminder.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/reminder.py b/plugins/reminder.py index 03711906..16a3f710 100644 --- a/plugins/reminder.py +++ b/plugins/reminder.py @@ -6,17 +6,17 @@ import timed_events class Plugin(BasePlugin): def init(self): - self.add_command('remind', self.command_remind, + self.api.add_command('remind', self.command_remind, usage='<seconds> <todo>', help='Remind you of <todo> every <time> seconds.', short='Remind you of a task', completion=self.completion_remind) - self.add_command('done', self.command_done, + self.api.add_command('done', self.command_done, usage='<id>', help='Stop reminding you do the task identified by <id>.', short='Remove a task', completion=self.completion_done) - self.add_command('tasks', self.command_tasks, + self.api.add_command('tasks', self.command_tasks, usage='', help='List all the current tasks and their ids.', short='List current tasks') @@ -46,8 +46,8 @@ class Plugin(BasePlugin): self.tasks[self.count] = (time, args[1]) timed_event = timed_events.DelayedEvent(time, self.remind, self.count) - self.core.add_timed_event(timed_event) - self.core.information('Task %s added: %s every %s.' % (self.count, args[1], + self.api.add_timed_event(timed_event) + self.api.information('Task %s added: %s every %s.' % (self.count, args[1], common.parse_secs_to_str(time)), 'Info') self.count += 1 @@ -71,7 +71,7 @@ class Plugin(BasePlugin): if not id in self.tasks: return - self.core.information('Task %s: %s [DONE]' % (id, self.tasks[id][1]), 'Info') + self.api.information('Task %s: %s [DONE]' % (id, self.tasks[id][1]), 'Info') del self.tasks[id] def command_tasks(self, arg, nocommand=None): @@ -83,16 +83,16 @@ class Plugin(BasePlugin): s += 'Task %s: %s every %s.\n' % (key, repr(self.tasks[key][1]), common.parse_secs_to_str(self.tasks[key][0])) if s: - self.core.information(s, 'Info') + self.api.information(s, 'Info') def remind(self, id=0): if not id in self.tasks: return - self.core.information('Task %s: %s' % (id, self.tasks[id][1]), 'Info') + self.api.information('Task %s: %s' % (id, self.tasks[id][1]), 'Info') if self.config.get('beep', '') == 'true': curses.beep() timed_event = timed_events.DelayedEvent(self.tasks[id][0], self.remind, id) - self.core.add_timed_event(timed_event) + self.api.add_timed_event(timed_event) def cleanup(self): if self.tasks: |