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):
|
def on_history_menuitem_clicked(self, widget = None, jid = None):
|
||||||
'''When history menuitem is pressed: call history window'''
|
'''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()
|
jid = self.get_active_jid()
|
||||||
if gajim.interface.instances['logs'].has_key(jid):
|
if gajim.interface.instances['logs'].has_key(jid):
|
||||||
gajim.interface.instances['logs'][jid].window.present()
|
gajim.interface.instances['logs'][jid].window.present()
|
||||||
else:
|
else:
|
||||||
gajim.interface.instances['logs'][jid] = history_window.HistoryWindow(jid,
|
gajim.interface.instances['logs'][jid] = history_window.HistoryWindow(
|
||||||
self.account)
|
jid, self.account)
|
||||||
|
|
||||||
def on_chat_window_focus_in_event(self, widget, event):
|
def on_chat_window_focus_in_event(self, widget, event):
|
||||||
'''When window gets focus'''
|
'''When window gets focus'''
|
||||||
|
|
|
@ -238,8 +238,16 @@ class HistoryWindow:
|
||||||
tag_name = 'incoming'
|
tag_name = 'incoming'
|
||||||
elif kind in (constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV):
|
elif kind in (constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV):
|
||||||
try:
|
try:
|
||||||
|
# is he in our roster? if yes use the name
|
||||||
contact_name = gajim.contacts[self.account][self.jid][0].name
|
contact_name = gajim.contacts[self.account][self.jid][0].name
|
||||||
except:
|
except:
|
||||||
|
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]
|
contact_name = self.jid.split('@')[0]
|
||||||
tag_name = 'incoming'
|
tag_name = 'incoming'
|
||||||
elif kind in (constants.KIND_SINGLE_MSG_SENT, constants.KIND_CHAT_MSG_SENT):
|
elif kind in (constants.KIND_SINGLE_MSG_SENT, constants.KIND_CHAT_MSG_SENT):
|
||||||
|
|
Loading…
Reference in New Issue