summaryrefslogtreecommitdiff
path: root/plugins/link.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
committermathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
commit9885203c6799c121f5bc8a733dc1937fe8c1b4d6 (patch)
tree4190635a7c9c78d2dce1a4c8357ccb887f12b8af /plugins/link.py
parentdbde08a5267cf003d8a4a9c16f5b18275e9a4bd1 (diff)
downloadpoezio-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/link.py')
-rw-r--r--plugins/link.py8
1 files changed, 4 insertions, 4 deletions
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