don't show signed in/out popup notification for 30 seconds for transport contacts when we log in/out this transport. Fixes #2041
This commit is contained in:
parent
ffa6465e74
commit
d10d8f7815
|
@ -105,6 +105,8 @@ nicks = {} # list of our nick names in each account
|
||||||
# should we block 'contact signed in' notifications for this account?
|
# should we block 'contact signed in' notifications for this account?
|
||||||
# this is only for the first 30 seconds after we change our show
|
# this is only for the first 30 seconds after we change our show
|
||||||
# to something else than offline
|
# to something else than offline
|
||||||
|
# can also contain account/transport_jid to block notifications for contacts
|
||||||
|
# from this transport
|
||||||
block_signed_in_notifications = {}
|
block_signed_in_notifications = {}
|
||||||
con_types = {} # type of each connection (ssl, tls, tcp, ...)
|
con_types = {} # type of each connection (ssl, tls, tcp, ...)
|
||||||
|
|
||||||
|
|
|
@ -431,6 +431,12 @@ class Interface:
|
||||||
if ji in jid_list:
|
if ji in jid_list:
|
||||||
# Update existing iter
|
# Update existing iter
|
||||||
self.roster.draw_contact(ji, account)
|
self.roster.draw_contact(ji, account)
|
||||||
|
# transport just signed in/out, don't show popup notifications
|
||||||
|
# for 30s
|
||||||
|
account_ji = account + '/' + ji
|
||||||
|
gajim.block_signed_in_notifications[account_ji] = True
|
||||||
|
gobject.timeout_add(30000, self.unblock_signed_in_notifications,
|
||||||
|
account_ji)
|
||||||
elif jid == gajim.get_jid_from_account(account):
|
elif jid == gajim.get_jid_from_account(account):
|
||||||
# It's another of our resources. We don't need to see that!
|
# It's another of our resources. We don't need to see that!
|
||||||
return
|
return
|
||||||
|
@ -1288,6 +1294,8 @@ class Interface:
|
||||||
|
|
||||||
def handle_event_signed_in(self, account, empty):
|
def handle_event_signed_in(self, account, empty):
|
||||||
'''SIGNED_IN event is emitted when we sign in, so handle it'''
|
'''SIGNED_IN event is emitted when we sign in, so handle it'''
|
||||||
|
# block signed in notifications for 30 seconds
|
||||||
|
gajim.block_signed_in_notifications[a] = True
|
||||||
self.roster.actions_menu_needs_rebuild = True
|
self.roster.actions_menu_needs_rebuild = True
|
||||||
if gajim.interface.sleeper.getState() != common.sleepy.STATE_UNKNOWN and \
|
if gajim.interface.sleeper.getState() != common.sleepy.STATE_UNKNOWN and \
|
||||||
gajim.connections[account].connected in (2, 3):
|
gajim.connections[account].connected in (2, 3):
|
||||||
|
|
|
@ -47,12 +47,20 @@ def notify(event, jid, account, parameters):
|
||||||
# Default : No popup for status change
|
# Default : No popup for status change
|
||||||
elif (event == 'contact_connected'):
|
elif (event == 'contact_connected'):
|
||||||
status_message = parameters
|
status_message = parameters
|
||||||
|
j = gajim.get_jid_without_resource(jid)
|
||||||
|
server = gajim.get_server_from_jid(j)
|
||||||
|
account_server = account + '/' + server
|
||||||
|
block_transport = False
|
||||||
|
if account_server in gajim.block_signed_in_notifications and \
|
||||||
|
gajim.block_signed_in_notifications[account_server]:
|
||||||
|
block_transport = True
|
||||||
if gajim.config.get('notify_on_signin') and \
|
if gajim.config.get('notify_on_signin') and \
|
||||||
not gajim.block_signed_in_notifications[account]\
|
not gajim.block_signed_in_notifications[account] and not block_transport \
|
||||||
and helpers.allow_showing_notification(account):
|
and helpers.allow_showing_notification(account):
|
||||||
do_popup = True
|
do_popup = True
|
||||||
if gajim.config.get_per('soundevents', 'contact_connected',
|
if gajim.config.get_per('soundevents', 'contact_connected',
|
||||||
'enabled') and not gajim.block_signed_in_notifications[account]:
|
'enabled') and not gajim.block_signed_in_notifications[account] and \
|
||||||
|
not block_transport:
|
||||||
do_sound = True
|
do_sound = True
|
||||||
elif (event == 'contact_disconnected'):
|
elif (event == 'contact_disconnected'):
|
||||||
status_message = parameters
|
status_message = parameters
|
||||||
|
|
Loading…
Reference in New Issue