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/ping.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/ping.py') diff --git a/plugins/ping.py b/plugins/ping.py index 22401a25..faf3e97d 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -8,18 +8,18 @@ import tabs class Plugin(BasePlugin): def init(self): self.core.xmpp.register_plugin('xep_0199') - self.add_command('ping', self.command_ping, + self.api.add_command('ping', self.command_ping, usage='', help='Send a XMPP ping to jid (see XEP-0199).', short='Send a ping', completion=self.completion_ping) - self.add_tab_command(tabs.MucTab, 'ping', self.command_muc_ping, + self.api.add_tab_command(tabs.MucTab, 'ping', self.command_muc_ping, usage='', help='Send a XMPP ping to jid or nick (see XEP-0199).', short='Send a ping.', completion=self.completion_muc_ping) for _class in (tabs.PrivateTab, tabs.ConversationTab): - self.add_tab_command(_class, 'ping', self.command_private_ping, + self.api.add_tab_command(_class, 'ping', self.command_private_ping, usage='[jid]', help='Send a XMPP ping to the current interlocutor or the given JID.', short='Send a ping', @@ -34,12 +34,12 @@ class Plugin(BasePlugin): except: delay = None if delay is not None: - self.core.information('%s responded to ping after %s s' % (jid, round(delay, 4)), 'Info') + self.api.information('%s responded to ping after %s s' % (jid, round(delay, 4)), 'Info') else: - self.core.information('%s did not respond to ping' % jid, 'Info') + self.api.information('%s did not respond to ping' % jid, 'Info') def completion_muc_ping(self, the_input): - users = [user.nick for user in self.core.current_tab().users] + users = [user.nick for user in self.api.current_tab().users] l = [contact.bare_jid for contact in roster.get_contacts()] users.extend(l) return the_input.auto_completion(users, '', quotify=False) @@ -47,14 +47,14 @@ class Plugin(BasePlugin): def command_private_ping(self, arg): if arg: return self.command_ping(arg) - self.command_ping(self.core.current_tab().get_name()) + self.command_ping(self.api.current_tab().get_name()) def command_muc_ping(self, arg): if not arg.strip(): return - user = self.core.current_tab().get_user_by_name(arg) + user = self.api.current_tab().get_user_by_name(arg) if user: - jid = safeJID(self.core.current_tab().get_name()) + jid = safeJID(self.api.current_tab().get_name()) jid.resource = user.nick else: jid = safeJID(arg) -- cgit v1.2.3