don't show sign in/out notifications if another resource or a metacontact brother is already connected. Fixes #5318

This commit is contained in:
Yann Leboulanger 2010-02-17 22:23:13 +01:00
parent b21d538b0f
commit 8abbf990ba

View file

@ -295,6 +295,7 @@ class Interface:
jid = array[0].split('/')[0]
keyID = array[5]
contact_nickname = array[7]
lcontact = []
# Get the proper keyID
keyID = helpers.prepare_and_validate_gpg_keyID(account, jid, keyID)
@ -309,8 +310,7 @@ class Interface:
else:
ji = jid
highest = gajim.contacts. \
get_contact_with_highest_priority(account, jid)
highest = gajim.contacts.get_contact_with_highest_priority(account, jid)
was_highest = (highest and highest.resource == resource)
conn = gajim.connections[account]
@ -464,12 +464,53 @@ class Interface:
account)
# Notifications
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:
self.remote_ctrl.raise_signal('ContactPresence', (account,
array))
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,
status_message)
if self.remote_ctrl: