handle correctly messages from invisible resources
This commit is contained in:
parent
b2d4177962
commit
ae8c6e309e
|
@ -402,12 +402,13 @@ class Interface:
|
||||||
elif contact1.show in statuss:
|
elif contact1.show in statuss:
|
||||||
old_show = statuss.index(contact1.show)
|
old_show = statuss.index(contact1.show)
|
||||||
if (resources != [''] and (len(lcontact) != 1 or
|
if (resources != [''] and (len(lcontact) != 1 or
|
||||||
lcontact[0].show != 'offline')) and jid.find('@') > 0:
|
lcontact[0].show != 'offline')) and jid.find('@') > 0:
|
||||||
old_show = 0
|
old_show = 0
|
||||||
contact1 = gajim.contacts.copy_contact(contact1)
|
contact1 = gajim.contacts.copy_contact(contact1)
|
||||||
lcontact.append(contact1)
|
lcontact.append(contact1)
|
||||||
contact1.resource = resource
|
contact1.resource = resource
|
||||||
if contact1.jid.find('@') > 0 and len(lcontact) == 1: # It's not an agent
|
if contact1.jid.find('@') > 0 and len(lcontact) == 1:
|
||||||
|
# It's not an agent
|
||||||
if old_show == 0 and new_show > 1:
|
if old_show == 0 and new_show > 1:
|
||||||
if not contact1.jid in gajim.newly_added[account]:
|
if not contact1.jid in gajim.newly_added[account]:
|
||||||
gajim.newly_added[account].append(contact1.jid)
|
gajim.newly_added[account].append(contact1.jid)
|
||||||
|
@ -538,7 +539,7 @@ class Interface:
|
||||||
chat_control = self.msg_win_mgr.get_control(jid, account)
|
chat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
|
|
||||||
# Handle chat states
|
# Handle chat states
|
||||||
contact = gajim.contacts.get_contact(account, jid)
|
contact = gajim.contacts.get_contact(account, jid, resource)
|
||||||
if contact and isinstance(contact, list):
|
if contact and isinstance(contact, list):
|
||||||
contact = contact[0]
|
contact = contact[0]
|
||||||
if contact:
|
if contact:
|
||||||
|
@ -578,7 +579,7 @@ class Interface:
|
||||||
# Is it a first or next message received ?
|
# Is it a first or next message received ?
|
||||||
first = False
|
first = False
|
||||||
if msg_type == 'normal':
|
if msg_type == 'normal':
|
||||||
if not gajim.events.get_events(account,jid, ['normal']):
|
if not gajim.events.get_events(account, jid, ['normal']):
|
||||||
first = True
|
first = True
|
||||||
elif not chat_control and not gajim.events.get_events(account,
|
elif not chat_control and not gajim.events.get_events(account,
|
||||||
jid_of_control, [msg_type]): # msg_type can be chat or pm
|
jid_of_control, [msg_type]): # msg_type can be chat or pm
|
||||||
|
|
|
@ -2795,10 +2795,23 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
highest_contact = gajim.contacts.get_contact_with_highest_priority(
|
||||||
account, jid)
|
account, jid)
|
||||||
if not contact:
|
if not contact:
|
||||||
# Default to highest prio
|
# If there is another resource, it may be a message from an invisible
|
||||||
fjid = jid
|
# resource
|
||||||
resource_for_chat = None
|
lcontact = gajim.contacts.get_contacts_from_jid(account, jid)
|
||||||
contact = highest_contact
|
if (len(lcontact) != 1 or lcontact[0].show != 'offline') and \
|
||||||
|
jid.find('@') > 0:
|
||||||
|
contact = gajim.contacts.copy_contact(highest_contact)
|
||||||
|
contact.resource = resource
|
||||||
|
contact.priority = 0
|
||||||
|
contact.show = 'offline'
|
||||||
|
contact.status = ''
|
||||||
|
gajim.contacts.add_contact(account, contact)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Default to highest prio
|
||||||
|
fjid = jid
|
||||||
|
resource_for_chat = None
|
||||||
|
contact = highest_contact
|
||||||
if not contact:
|
if not contact:
|
||||||
# contact is not in roster
|
# contact is not in roster
|
||||||
contact = self.add_to_not_in_the_roster(account, jid)
|
contact = self.add_to_not_in_the_roster(account, jid)
|
||||||
|
|
Loading…
Reference in New Issue