From 1c336ede9fe0c5600323ad8b8a7c2a8216f57928 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 6 Apr 2009 10:06:26 +0000 Subject: [PATCH] add advanced option to ask offline status on connection. Fixes #3597 --- src/common/config.py | 1 + src/gajim.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/common/config.py b/src/common/config.py index cf573dc1e..2bbf476bd 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -269,6 +269,7 @@ class Config: 'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')], 'latex_png_dpi': [opt_str, '108',_('Change the value to change the size of latex formulas displayed. The higher is larger.') ], 'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True], + 'ask_offline_status_on_connection': [ opt_bool, False, _('Ask offline status message to all offline contacts when connection to an accoutn is established. WARNING: This causes a lot of requests to be sent!') ], } __options_per_key = { diff --git a/src/gajim.py b/src/gajim.py index 96c750b4b..20912859b 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -1869,6 +1869,11 @@ class Interface: win = self.instances[account]['profile'] win.vcard_not_published() + def ask_offline_status(self, account): + for contact in gajim.contacts.iter_contacts(account): + gajim.connections[account].request_last_status_time(contact.jid, + contact.resource) + 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 @@ -1877,6 +1882,10 @@ class Interface: self.roster.draw_account(account) state = self.sleeper.getState() connected = gajim.connections[account].connected + if gajim.config.get('ask_offline_status_on_connection'): + # Ask offline status in 1 minute so w'are sure we got all online + # presences + gobject.timeout_add_seconds(60, self.ask_offline_status, account) if state != common.sleepy.STATE_UNKNOWN and connected in (2, 3): # we go online or free for chat, so we activate auto status gajim.sleeper_state[account] = 'online'