diff options
-rw-r--r-- | src/tabs.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/tabs.py b/src/tabs.py index f037a368..5b9c9fe8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -2000,10 +2000,13 @@ class ConversationTab(ChatTab): def on_lose_focus(self): contact = roster.get_contact_by_jid(self.get_name()) jid = JID(self.get_name()) - if jid.resource: - resource = contact.get_resource_by_fulljid(jid.full) + if contact: + if jid.resource: + resource = contact.get_resource_by_fulljid(jid.full) + else: + resource = contact.get_highest_priority_resource() else: - resource = contact.get_highest_priority_resource() + resource = None self.state = 'normal' self.text_win.remove_line_separator() self.text_win.add_line_separator() @@ -2014,10 +2017,14 @@ class ConversationTab(ChatTab): def on_gain_focus(self): contact = roster.get_contact_by_jid(self.get_name()) jid = JID(self.get_name()) - if jid.resource: - resource = contact.get_resource_by_fulljid(jid.full) + if contact: + if jid.resource: + resource = contact.get_resource_by_fulljid(jid.full) + else: + resource = contact.get_highest_priority_resource() else: - resource = contact.get_highest_priority_resource() + resource = None + self.state = 'current' curses.curs_set(1) if config.get('send_chat_states', 'true') == 'true' and not self.input.get_text() or not self.input.get_text().startswith('//'): |