From 9885203c6799c121f5bc8a733dc1937fe8c1b4d6 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 8 Mar 2013 22:53:35 +0100 Subject: 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 --- plugins/display_corrections.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/display_corrections.py') diff --git a/plugins/display_corrections.py b/plugins/display_corrections.py index 6e122bfe..cad5a327 100644 --- a/plugins/display_corrections.py +++ b/plugins/display_corrections.py @@ -8,14 +8,14 @@ import tabs class Plugin(BasePlugin): def init(self): for tab_type in (tabs.MucTab, tabs.PrivateTab, tabs.ConversationTab): - self.add_tab_command(tab_type, 'display_corrections', + self.api.add_tab_command(tab_type, 'display_corrections', handler=self.command_display_corrections, usage='', help='Display all the corrections of the number-th last corrected message.', short='Display the corrections of a message') def find_corrected(self, nb): - messages = self.core.get_conversation_messages() + messages = self.api.get_conversation_messages() if not messages: return None for message in messages[::-1]: @@ -32,7 +32,7 @@ class Plugin(BasePlugin): try: nb = int(args[0]) except: - return self.core.command_help('display_corrections') + return self.api.run_command('/help display_corrections') else: nb = 1 message = self.find_corrected(nb) @@ -41,9 +41,9 @@ class Plugin(BasePlugin): while message: display.append('%s %s%s%s %s' % (message.str_time, '* ' if message.me else '', message.nickname, '' if message.me else '>', message.txt)) message = message.old_message - self.core.information('Older versions:\n' + '\n'.join(display[::-1]), 'Info') + self.api.information('Older versions:\n' + '\n'.join(display[::-1]), 'Info') else: - self.core.information('No corrected message found.', 'Warning') + self.api.information('No corrected message found.', 'Warning') def cleanup(self): del self.config -- cgit v1.2.3