diff options
author | mathieui <mathieui@mathieui.net> | 2013-03-01 02:05:18 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-03-01 02:05:18 +0100 |
commit | 9b92cb7fb6fc6f5b507e978efddeb9856ed58619 (patch) | |
tree | 5f11f0aea74162f588d5a5d12e6cfeb5134141df | |
parent | 6afc1f915c7b736920ae97c6be4046e356c1bc28 (diff) | |
download | poezio-9b92cb7fb6fc6f5b507e978efddeb9856ed58619.tar.gz poezio-9b92cb7fb6fc6f5b507e978efddeb9856ed58619.tar.bz2 poezio-9b92cb7fb6fc6f5b507e978efddeb9856ed58619.tar.xz poezio-9b92cb7fb6fc6f5b507e978efddeb9856ed58619.zip |
Improve the ping plugin
fix a TB in the MUC
fix the completion (no quotes)
add a timeout of 5 seconds
-rw-r--r-- | plugins/ping.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/ping.py b/plugins/ping.py index 2c890563..b3ba8fb1 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -11,14 +11,14 @@ class Plugin(BasePlugin): self.add_command('ping', self.command_ping, '/ping <jid>\nPing: Send a XMPP ping to jid (see XEP-0199).', self.completion_ping) self.add_tab_command(tabs.MucTab, 'ping', self.command_muc_ping, '/ping <jid or nick>\nPing: Send a XMPP ping to jid or nick (see XEP-0199)', self.completion_muc_ping) self.add_tab_command(tabs.PrivateTab, 'ping', self.command_private_ping, '/ping\nPing: Send a XMPP ping to the current interlocutor (see XEP-0199)') - self.add_tab_command(tabs.ConversationTab, 'ping', self.command_private_ping, '/ping\nPing: Send a XMPP ping to the current interlocutor (see XEP-0199)') + self.add_tab_command(tabs.ConversationTab, 'ping', self.command_private_ping, '/ping\nPing: Send a XMPP ping to the current interlocutor (see XEP-0199)', self.completion_ping) def command_ping(self, arg): if not arg: return jid = safeJID(arg) try: - delay = self.core.xmpp.plugin['xep_0199'].ping(jid=jid) + delay = self.core.xmpp.plugin['xep_0199'].ping(jid=jid, timeout=5) except: delay = None if delay is not None: @@ -30,24 +30,25 @@ class Plugin(BasePlugin): users = [user.nick for user in self.core.current_tab().users] l = [contact.bare_jid for contact in roster.get_contacts()] users.extend(l) - return the_input.auto_completion(users, '') + return the_input.auto_completion(users, '', quotify=False) def command_private_ping(self, arg): + if arg: + self.command_ping(arg) self.command_ping(self.core.current_tab().get_name()) def command_muc_ping(self, arg): - args = common.shell_split(arg) - if not args: + if not arg.strip(): return - user = self.core.current_tab().get_user_by_name(args[0]) + user = self.core.current_tab().get_user_by_name(arg) if user: - jid = JID(self.core.current_tab().get_name()) + jid = safeJID(self.core.current_tab().get_name()) jid.resource = user.nick else: - jid = JID(args[0]) + jid = safeJID(arg) self.command_ping(jid.full) def completion_ping(self, the_input): l = [contact.bare_jid for contact in roster.get_contacts()] - return the_input.auto_completion(l, '') + return the_input.auto_completion(l, '', quotify=False) |