From 2d9cf5f96d07481255d4b3be7d59545787cb7ef6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 28 Dec 2005 22:24:03 +0000 Subject: [PATCH] use contacts functions in history_window --- src/history_window.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/history_window.py b/src/history_window.py index 7ffc3e67d..cd644d5bf 100644 --- a/src/history_window.py +++ b/src/history_window.py @@ -105,8 +105,8 @@ class HistoryWindow: col.set_attributes(renderer, text = C_MESSAGE) col.set_resizable(True) - if account and gajim.contacts[account].has_key(jid): - contact = gajim.get_first_contact_instance_from_jid(account, jid) + contact = gajim.contacts.get_first_contact_from_jid(account, jid) + if contact: title = _('Conversation History with %s') % contact.name else: title = _('Conversation History with %s') % jid @@ -237,14 +237,17 @@ class HistoryWindow: if kind == constants.KIND_GC_MSG: tag_name = 'incoming' elif kind in (constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV): - try: - # is he in our roster? if yes use the name - contact_name = gajim.contacts[self.account][self.jid][0].name - except: + contact = gajim.contacts.get_first_contactfrom_jid(self.account, + self.jid) + if contact: + # he is in our roster, use the name + contact_name = contact.name + else: room_jid, nick = gajim.get_room_and_nick_from_fjid(self.jid) # do we have him as gc_contact? - if nick and gajim.gc_contacts[self.account].has_key(room_jid) and\ - gajim.gc_contacts[self.account][room_jid].has_key(nick): + gc_contact = gajim.contacts.get_gc_contact(self.account, room_jid, + nick) + if gc_contact: # so yes, it's pm! contact_name = nick else: