detect and print correct name for history nickname in pm. we could also as logger.jid_is_from_pm but that means asking again HD, so I chose asking gc_contacts (mem super faster)
This commit is contained in:
parent
e39eb2a4e7
commit
6cc869152c
|
@ -330,13 +330,13 @@ class Chat:
|
|||
|
||||
def on_history_menuitem_clicked(self, widget = None, jid = None):
|
||||
'''When history menuitem is pressed: call history window'''
|
||||
if jid is None:
|
||||
if jid is None: # None when viewing room and tc history
|
||||
jid = self.get_active_jid()
|
||||
if gajim.interface.instances['logs'].has_key(jid):
|
||||
gajim.interface.instances['logs'][jid].window.present()
|
||||
else:
|
||||
gajim.interface.instances['logs'][jid] = history_window.HistoryWindow(jid,
|
||||
self.account)
|
||||
gajim.interface.instances['logs'][jid] = history_window.HistoryWindow(
|
||||
jid, self.account)
|
||||
|
||||
def on_chat_window_focus_in_event(self, widget, event):
|
||||
'''When window gets focus'''
|
||||
|
|
|
@ -238,9 +238,17 @@ class HistoryWindow:
|
|||
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_name = self.jid.split('@')[0]
|
||||
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):
|
||||
# so yes, it's pm!
|
||||
contact_name = nick
|
||||
else:
|
||||
contact_name = self.jid.split('@')[0]
|
||||
tag_name = 'incoming'
|
||||
elif kind in (constants.KIND_SINGLE_MSG_SENT, constants.KIND_CHAT_MSG_SENT):
|
||||
contact_name = gajim.nicks[self.account]
|
||||
|
|
Loading…
Reference in New Issue