don't show sign in/out notifications if another resource or a metacontact brother is already connected. Fixes #5318
This commit is contained in:
parent
b21d538b0f
commit
8abbf990ba
1 changed files with 53 additions and 12 deletions
|
@ -295,6 +295,7 @@ class Interface:
|
||||||
jid = array[0].split('/')[0]
|
jid = array[0].split('/')[0]
|
||||||
keyID = array[5]
|
keyID = array[5]
|
||||||
contact_nickname = array[7]
|
contact_nickname = array[7]
|
||||||
|
lcontact = []
|
||||||
|
|
||||||
# Get the proper keyID
|
# Get the proper keyID
|
||||||
keyID = helpers.prepare_and_validate_gpg_keyID(account, jid, keyID)
|
keyID = helpers.prepare_and_validate_gpg_keyID(account, jid, keyID)
|
||||||
|
@ -309,8 +310,7 @@ class Interface:
|
||||||
else:
|
else:
|
||||||
ji = jid
|
ji = jid
|
||||||
|
|
||||||
highest = gajim.contacts. \
|
highest = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
get_contact_with_highest_priority(account, jid)
|
|
||||||
was_highest = (highest and highest.resource == resource)
|
was_highest = (highest and highest.resource == resource)
|
||||||
|
|
||||||
conn = gajim.connections[account]
|
conn = gajim.connections[account]
|
||||||
|
@ -464,12 +464,53 @@ class Interface:
|
||||||
account)
|
account)
|
||||||
# Notifications
|
# Notifications
|
||||||
if old_show < 2 and new_show > 1:
|
if old_show < 2 and new_show > 1:
|
||||||
notify.notify('contact_connected', jid, account, status_message)
|
show_notif = True
|
||||||
|
for c in lcontact:
|
||||||
|
if c.resource == resource:
|
||||||
|
# we look for other connected resources
|
||||||
|
continue
|
||||||
|
if c.show not in ('offline', 'error'):
|
||||||
|
show_notif = False
|
||||||
|
break
|
||||||
|
if show_notif:
|
||||||
|
# no other resource is connected, let's look in metacontacts
|
||||||
|
family = gajim.contacts.get_metacontacts_family(account, ji)
|
||||||
|
for info in family:
|
||||||
|
acct_ = info['account']
|
||||||
|
jid_ = info['jid']
|
||||||
|
c_ = gajim.contacts.get_contact_with_highest_priority(
|
||||||
|
acct_, jid_)
|
||||||
|
if c_.show not in ('offline', 'error'):
|
||||||
|
show_notif = False
|
||||||
|
break
|
||||||
|
if show_notif:
|
||||||
|
notify.notify('contact_connected', jid, account,
|
||||||
|
status_message)
|
||||||
if self.remote_ctrl:
|
if self.remote_ctrl:
|
||||||
self.remote_ctrl.raise_signal('ContactPresence', (account,
|
self.remote_ctrl.raise_signal('ContactPresence', (account,
|
||||||
array))
|
array))
|
||||||
|
|
||||||
elif old_show > 1 and new_show < 2:
|
elif old_show > 1 and new_show < 2:
|
||||||
|
show_notif = True
|
||||||
|
for c in lcontact:
|
||||||
|
if c.resource == resource:
|
||||||
|
# we look for other connected resources
|
||||||
|
continue
|
||||||
|
if c.show not in ('offline', 'error'):
|
||||||
|
show_notif = False
|
||||||
|
break
|
||||||
|
if show_notif:
|
||||||
|
# no other resource is connected, let's look in metacontacts
|
||||||
|
family = gajim.contacts.get_metacontacts_family(account, ji)
|
||||||
|
for info in family:
|
||||||
|
acct_ = info['account']
|
||||||
|
jid_ = info['jid']
|
||||||
|
c_ = gajim.contacts.get_contact_with_highest_priority(
|
||||||
|
acct_, jid_)
|
||||||
|
if c_.show not in ('offline', 'error'):
|
||||||
|
show_notif = False
|
||||||
|
break
|
||||||
|
if show_notif:
|
||||||
notify.notify('contact_disconnected', jid, account,
|
notify.notify('contact_disconnected', jid, account,
|
||||||
status_message)
|
status_message)
|
||||||
if self.remote_ctrl:
|
if self.remote_ctrl:
|
||||||
|
|
Loading…
Add table
Reference in a new issue