diff options
author | mathieui <mathieui@mathieui.net> | 2012-07-17 21:56:04 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-07-17 21:56:04 +0200 |
commit | 8317b845d810353daab07a467199f411c3fceaa4 (patch) | |
tree | c727d43b7cb2deac2a6dd2e28444e08374b8dd54 /src/core.py | |
parent | 93228356597df66ebcb38f3f4fb8fbc07f198cec (diff) | |
download | poezio-8317b845d810353daab07a467199f411c3fceaa4.tar.gz poezio-8317b845d810353daab07a467199f411c3fceaa4.tar.bz2 poezio-8317b845d810353daab07a467199f411c3fceaa4.tar.xz poezio-8317b845d810353daab07a467199f411c3fceaa4.zip |
Fix /version to find a fulljid when available
And improve the completion in the roster (go to the resources)
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py index 4fc8a8b1..f4d11a38 100644 --- a/src/core.py +++ b/src/core.py @@ -13,6 +13,7 @@ import time import curses import ssl +from functools import reduce from hashlib import sha1 from datetime import datetime from xml.etree import cElementTree as ET @@ -1706,8 +1707,14 @@ class Core(object): args = common.shell_split(arg) if len(args) < 1: return self.command_help('version') - jid = args[0] - self.xmpp.plugin['xep_0092'].get_version(jid, callback=callback) + jid = JID(args[0]) + if jid.resource or jid not in roster: + self.xmpp.plugin['xep_0092'].get_version(jid, callback=callback) + elif jid in roster: + for resource in roster[jid].resources: + self.xmpp.plugin['xep_0092'].get_version(resource.jid, callback=callback) + else: + self.xmpp.plugin['xep_0092'].get_version(jid, callback=callback) def command_reconnect(self, args=None): """ @@ -1909,7 +1916,9 @@ class Core(object): n = len(the_input.get_text().split()) if n > 2 or (n == 2 and the_input.get_text().endswith(' ')): return - return the_input.auto_completion([jid for jid in roster.jids()], '', quotify=False) + comp = reduce(lambda x, y: x+y, (jid.resources for jid in roster if len(jid)), []) + comp = (str(res.jid) for res in comp) + return the_input.auto_completion(sorted(comp), '', quotify=False) def completion_list(self, the_input): """Completion for /list""" |