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/link.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/link.py') diff --git a/plugins/link.py b/plugins/link.py index 0d88fba2..9e8b6f97 100644 --- a/plugins/link.py +++ b/plugins/link.py @@ -13,13 +13,13 @@ url_pattern = re.compile(r'\b(http[s]?://(?:\S+))\b', re.I|re.U) class Plugin(BasePlugin): def init(self): for _class in (tabs.MucTab, tabs.PrivateTab, tabs.ConversationTab): - self.add_tab_command(_class, 'link', self.command_link, + self.api.add_tab_command(_class, 'link', self.command_link, usage='[num]', help='Opens the last link from the conversation into a browser.\nIf [num] is given, then it will open the num-th link displayed.', short='Open links into a browser') def find_link(self, nb): - messages = self.core.get_conversation_messages() + messages = self.api.get_conversation_messages() if not messages: return None for message in messages[::-1]: @@ -38,14 +38,14 @@ class Plugin(BasePlugin): try: nb = int(args[0]) except: - return self.core.command_help('link') + return self.api.run_command('/help link') else: nb = 1 link = self.find_link(nb) if link: self.core.exec_command([self.config.get('browser', 'firefox'), link]) else: - self.core.information('No URL found.', 'Warning') + self.api.information('No URL found.', 'Warning') def cleanup(self): del self.config -- cgit v1.2.3