handle correctly pm
This commit is contained in:
parent
90e5561860
commit
becf3c4c3a
20
src/gajim.py
20
src/gajim.py
|
@ -488,6 +488,13 @@ class Interface:
|
||||||
if gajim.jid_is_transport(jid):
|
if gajim.jid_is_transport(jid):
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
|
|
||||||
|
groupchat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
|
pm = False
|
||||||
|
if groupchat_control and groupchat_control.type_id == \
|
||||||
|
message_control.TYPE_GC:
|
||||||
|
# It's a Private message
|
||||||
|
pm = True
|
||||||
|
|
||||||
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
||||||
account, jid)
|
account, jid)
|
||||||
# Look for a chat control that has the given resource, or default to one
|
# Look for a chat control that has the given resource, or default to one
|
||||||
|
@ -496,18 +503,17 @@ class Interface:
|
||||||
if ctrl:
|
if ctrl:
|
||||||
jid_of_control = full_jid_with_resource
|
jid_of_control = full_jid_with_resource
|
||||||
chat_control = ctrl
|
chat_control = ctrl
|
||||||
elif not highest_contact or not highest_contact.resource:
|
elif not pm and (not highest_contact or not highest_contact.resource):
|
||||||
# unknow contact or offline message
|
# unknow contact or offline message
|
||||||
jid_of_control = jid
|
jid_of_control = jid
|
||||||
chat_control = self.msg_win_mgr.get_control(jid, account)
|
chat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
elif resource != highest_contact.resource:
|
elif highest_contact and resource != highest_contact.resource:
|
||||||
jid_of_control = full_jid_with_resource
|
jid_of_control = full_jid_with_resource
|
||||||
chat_control = None
|
chat_control = None
|
||||||
else:
|
elif not pm:
|
||||||
jid_of_control = jid
|
jid_of_control = jid
|
||||||
chat_control = self.msg_win_mgr.get_control(jid, account)
|
chat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
|
|
||||||
groupchat_control = self.msg_win_mgr.get_control(jid, account)
|
|
||||||
# Handle chat states
|
# Handle chat states
|
||||||
contact = gajim.contacts.get_contact(account, jid, resource)
|
contact = gajim.contacts.get_contact(account, jid, resource)
|
||||||
if contact:
|
if contact:
|
||||||
|
@ -534,12 +540,6 @@ class Interface:
|
||||||
if not message: # empty message text
|
if not message: # empty message text
|
||||||
return
|
return
|
||||||
|
|
||||||
pm = False
|
|
||||||
if groupchat_control and groupchat_control.type_id == \
|
|
||||||
message_control.TYPE_GC:
|
|
||||||
# It's a Private message
|
|
||||||
pm = True
|
|
||||||
|
|
||||||
first = False
|
first = False
|
||||||
if not chat_control and not gajim.awaiting_events[account].has_key(
|
if not chat_control and not gajim.awaiting_events[account].has_key(
|
||||||
jid_of_control):
|
jid_of_control):
|
||||||
|
|
Loading…
Reference in New Issue