diff --git a/src/common/gajim.py b/src/common/gajim.py index b4afc2508..0e17ad8de 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -105,6 +105,8 @@ nicks = {} # list of our nick names in each account # should we block 'contact signed in' notifications for this account? # this is only for the first 30 seconds after we change our show # to something else than offline +# can also contain account/transport_jid to block notifications for contacts +# from this transport block_signed_in_notifications = {} con_types = {} # type of each connection (ssl, tls, tcp, ...) diff --git a/src/gajim.py b/src/gajim.py index 9d8f2c2cf..9d3aa250b 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -431,6 +431,12 @@ class Interface: if ji in jid_list: # Update existing iter 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): # It's another of our resources. We don't need to see that! return @@ -1288,6 +1294,8 @@ class Interface: def handle_event_signed_in(self, account, empty): '''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 if gajim.interface.sleeper.getState() != common.sleepy.STATE_UNKNOWN and \ gajim.connections[account].connected in (2, 3): diff --git a/src/notify.py b/src/notify.py index 201392899..d10ac8a80 100644 --- a/src/notify.py +++ b/src/notify.py @@ -47,12 +47,20 @@ def notify(event, jid, account, parameters): # Default : No popup for status change elif (event == 'contact_connected'): 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 \ - not gajim.block_signed_in_notifications[account]\ - and helpers.allow_showing_notification(account): + not gajim.block_signed_in_notifications[account] and not block_transport \ + and helpers.allow_showing_notification(account): do_popup = True 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 elif (event == 'contact_disconnected'): status_message = parameters