Fix #2320 (TB on /info with an off-roster contact)
This commit is contained in:
parent
833faa4f37
commit
2b7676194f
2 changed files with 15 additions and 4 deletions
|
@ -41,6 +41,8 @@ class Resource(object):
|
||||||
def presence(self):
|
def presence(self):
|
||||||
return self._data.get('show') or ''
|
return self._data.get('show') or ''
|
||||||
|
|
||||||
|
show = presence
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def status(self):
|
def status(self):
|
||||||
return self._data.get('status') or ''
|
return self._data.get('status') or ''
|
||||||
|
|
17
src/tabs.py
17
src/tabs.py
|
@ -3189,13 +3189,22 @@ class ConversationTab(ChatTab):
|
||||||
def command_info(self, arg):
|
def command_info(self, arg):
|
||||||
contact = roster[self.get_dest_jid()]
|
contact = roster[self.get_dest_jid()]
|
||||||
jid = safeJID(self.get_dest_jid())
|
jid = safeJID(self.get_dest_jid())
|
||||||
if jid.resource:
|
if contact:
|
||||||
resource = contact[jid.full]
|
if jid.resource:
|
||||||
|
resource = contact[jid.full]
|
||||||
|
else:
|
||||||
|
resource = contact.get_highest_priority_resource()
|
||||||
else:
|
else:
|
||||||
resource = contact.get_highest_priority_resource()
|
resource = None
|
||||||
if resource:
|
if resource:
|
||||||
self._text_buffer.add_message("\x19%(info_col)s}Status: %(status)s\x193}" % {'status': resource.status, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, None, None, None, None, None)
|
status = (_('Status : %s') % resource.status) if resource.status else ''
|
||||||
|
self._text_buffer.add_message("\x19%(info_col)s}Show: %(show)s, %(status)s\x19o" % {
|
||||||
|
'show': resource.show or 'available', 'status': status, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)})
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
self._text_buffer.add_message("\x19%(info_col)s}No information available\x19o" % {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)})
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def command_attention(self, message=''):
|
def command_attention(self, message=''):
|
||||||
if message is not '':
|
if message is not '':
|
||||||
|
|
Loading…
Reference in a new issue