add advanced option to ask offline status on connection. Fixes #3597

This commit is contained in:
Yann Leboulanger 2009-04-06 10:06:26 +00:00
parent e749d5941f
commit 1c336ede9f
2 changed files with 10 additions and 0 deletions

View File

@ -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 = {

View File

@ -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'