[commit-gajim] r11197 - in trunk/src: . common

asterix at gajim.org asterix at gajim.org
Mon Apr 6 12:06:26 CEST 2009


Author: asterix
Date: 2009-04-06 12:06:26 +0200 (Mon, 06 Apr 2009)
New Revision: 11197

Modified:
   trunk/src/common/config.py
   trunk/src/gajim.py
Log:
add advanced option to ask offline status on connection. Fixes #3597


Modified: trunk/src/common/config.py
===================================================================
--- trunk/src/common/config.py	2009-04-05 18:49:43 UTC (rev 11196)
+++ trunk/src/common/config.py	2009-04-06 10:06:26 UTC (rev 11197)
@@ -269,6 +269,7 @@
 		'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 = {

Modified: trunk/src/gajim.py
===================================================================
--- trunk/src/gajim.py	2009-04-05 18:49:43 UTC (rev 11196)
+++ trunk/src/gajim.py	2009-04-06 10:06:26 UTC (rev 11197)
@@ -1869,6 +1869,11 @@
 			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 @@
 		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'



More information about the Commits mailing list