summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.py15
-rw-r--r--src/tabs.py5
2 files changed, 17 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"""
diff --git a/src/tabs.py b/src/tabs.py
index dfa5f529..33a7126b 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -2577,6 +2577,11 @@ class ConversationTab(ChatTab):
if arg:
return self.core.command_version(arg)
jid = self.name
+ jid = JID(jid)
+ if not jid.resource:
+ if jid in roster:
+ resource = roster[jid].get_highest_priority_resource()
+ jid = resource.jid if resource else jid
self.core.xmpp.plugin['xep_0092'].get_version(jid, callback=callback)
def resize(self):