diff --git a/src/config.py b/src/config.py index 578a155cc..accb2dee4 100644 --- a/src/config.py +++ b/src/config.py @@ -1118,6 +1118,8 @@ class Account_modification_window: self.plugin.windows[name] = self.plugin.windows[self.account] self.plugin.queues[name] = self.plugin.queues[self.account] self.plugin.nicks[name] = self.plugin.nicks[self.account] + self.plugin.allow_notifications[name] = \ + self.plugin.allow_notifications[self.account] self.plugin.roster.groups[name] = \ self.plugin.roster.groups[self.account] self.plugin.roster.contacts[name] = \ @@ -1139,6 +1141,7 @@ class Account_modification_window: del self.plugin.windows[self.account] del self.plugin.queues[self.account] del self.plugin.nicks[self.account] + del self.plugin.allow_notifications[self.account] del self.plugin.roster.groups[self.account] del self.plugin.roster.contacts[self.account] del self.plugin.sleeper_state[self.account] @@ -1187,6 +1190,7 @@ class Account_modification_window: self.plugin.roster.newly_added[name] = [] self.plugin.roster.to_be_removed[name] = [] self.plugin.nicks[name] = config['name'] + self.plugin.allow_notifications[name] = False self.plugin.sleeper_state[name] = 0 #refresh accounts window if self.plugin.windows.has_key('accounts'): @@ -2011,6 +2015,8 @@ class Remove_account_window: self.plugin.save_config() del self.plugin.windows[self.account] del self.plugin.queues[self.account] + del self.plugin.nicks[self.account] + del self.plugin.allow_notifications[self.account] del self.plugin.roster.groups[self.account] del self.plugin.roster.contacts[self.account] del self.plugin.roster.to_be_removed[self.account] diff --git a/src/gajim.py b/src/gajim.py index ab2e8e7d9..1f3bde11d 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -154,8 +154,13 @@ class Interface: self.windows[account]['gc'][jid_from].print_conversation( 'Error %s: %s' % (array[2], array[1]), jid_from) + def allow_notif(self, account): + self.allow_notifications[account] = True + def handle_event_status(self, account, status): # OUR status #('STATUS', account, status) + if status != 'offline': + gobject.timeout_add(30000, self.allow_notif, account) self.roster.on_status_changed(account, status) def handle_event_notify(self, account, array): @@ -237,7 +242,8 @@ class Interface: self.play_sound('contact_connected') if not self.windows[account]['chats'].has_key(jid) and \ not self.queues[account].has_key(jid) and \ - gajim.config.get('notify_on_online'): + gajim.config.get('notify_on_online') and \ + self.allow_notifications[account]: show_notification = False # check OUR status and if we allow notifications for that status if gajim.config.get('autopopupaway'): # always notify @@ -389,6 +395,7 @@ class Interface: self.queues[name] = {} gajim.connections[name].connected = 0 self.nicks[name] = array[1]['name'] + self.allow_notifications[name] = False self.roster.groups[name] = {} self.roster.contacts[name] = {} self.roster.newly_added[name] = [] @@ -666,11 +673,13 @@ class Interface: self.windows = {'logs':{}} self.queues = {} self.nicks = {} + self.allow_notifications = {} self.sleeper_state = {} #whether we pass auto away / xa or not for a in gajim.connections: self.windows[a] = {'infos': {}, 'chats': {}, 'gc': {}, 'gc_config': {}} self.queues[a] = {} self.nicks[a] = gajim.config.get_per('accounts', a, 'name') + self.allow_notifications[a] = False self.sleeper_state[a] = 0 #0:don't use sleeper for this account #1:online and use sleeper #2:autoaway and use sleeper diff --git a/src/roster_window.py b/src/roster_window.py index c28319adb..282267f7c 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -740,7 +740,6 @@ class Roster_window: accountIter = self.get_account_iter(account) if accountIter: model.set_value(accountIter, 0, self.jabber_state_images['connecting']) -# gajim.connections[account].connected = 1 if self.plugin.systray_enabled: self.plugin.systray.set_status('connecting')