diff options
author | mathieui <mathieui@mathieui.net> | 2013-06-14 20:36:04 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-06-14 20:36:04 +0200 |
commit | 2b7676194f174ebb5019d0be1c83c2827af545c9 (patch) | |
tree | fa868727251dd90e3ac8d7d1280f38212ad4d02a /src/tabs.py | |
parent | 833faa4f370f26f2b2296114da27473d2cb6bfb5 (diff) | |
download | poezio-2b7676194f174ebb5019d0be1c83c2827af545c9.tar.gz poezio-2b7676194f174ebb5019d0be1c83c2827af545c9.tar.bz2 poezio-2b7676194f174ebb5019d0be1c83c2827af545c9.tar.xz poezio-2b7676194f174ebb5019d0be1c83c2827af545c9.zip |
Fix #2320 (TB on /info with an off-roster contact)
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tabs.py b/src/tabs.py index fb6b393b..d4267c59 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -3189,14 +3189,23 @@ class ConversationTab(ChatTab): def command_info(self, arg): contact = roster[self.get_dest_jid()] jid = safeJID(self.get_dest_jid()) - if jid.resource: - resource = contact[jid.full] + if contact: + if jid.resource: + resource = contact[jid.full] + else: + resource = contact.get_highest_priority_resource() else: - resource = contact.get_highest_priority_resource() + resource = None 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 + 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=''): if message is not '': self.command_say(message, attention=True) |