be sure chat_control.contact is never None, even when server connection is brocken. Fixes #1878

This commit is contained in:
Yann Leboulanger 2006-04-20 16:57:43 +00:00
parent c2519046cc
commit d040cc13fc
2 changed files with 6 additions and 4 deletions

View File

@ -1618,8 +1618,10 @@ class ChatControl(ChatControlBase):
def got_connected(self):
ChatControlBase.got_connected(self)
# Refreshing contact
self.contact = gajim.contacts.get_contact_with_highest_priority(
contact = gajim.contacts.get_contact_with_highest_priority(
self.account, self.contact.jid)
if isinstance(self.contact, GC_Contact):
self.contact = gajim.contacts.contact_from_gc_contact(self.contact)
if isinstance(contact, GC_Contact):
contact = gajim.contacts.contact_from_gc_contact(contact)
if contact:
self.contact = contact
self.draw_banner()

View File

@ -212,7 +212,7 @@ class Contacts:
# jid may be a fake jid, try it
room, nick = jid.split('/')
contact = self.get_gc_contact(account, room, nick)
return contact or []
return contact
return self.get_highest_prio_contact_from_contacts(contacts)
def get_first_contact_from_jid(self, account, jid):