summaryrefslogtreecommitdiff
path: root/plugins/ping.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/ping.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/ping.py')
-rw-r--r--plugins/ping.py18
1 files changed, 9 insertions, 9 deletions
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='<jid>',
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='<jid|nick>',
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)