missing commit. see #4643

This commit is contained in:
Yann Leboulanger 2009-05-01 09:40:03 +00:00
parent 5d8e96ad47
commit f8267ad047

View file

@ -147,9 +147,15 @@ class Connection(ConnectionHandlers):
'hostname': socket.gethostname() 'hostname': socket.gethostname()
}) })
if gajim.config.get_per('accounts', self.name, 'keep_alives_enabled'): if gajim.config.get_per('accounts', self.name, 'keep_alives_enabled'):
self.keepalives = gajim.config.get_per('accounts', self.name,'keep_alive_every_foo_secs') self.keepalives = gajim.config.get_per('accounts', self.name,
'keep_alive_every_foo_secs')
else: else:
self.keepalives = 0 self.keepalives = 0
if gajim.config.get_per('accounts', self.name, 'ping_alives_enabled'):
self.pingalives = gajim.config.get_per('accounts', self.name,
'ping_alive_every_foo_secs')
else:
self.pingalives = 0
self.privacy_rules_supported = False self.privacy_rules_supported = False
self.blocked_list = [] self.blocked_list = []
self.blocked_contacts = [] self.blocked_contacts = []
@ -832,8 +838,8 @@ class Connection(ConnectionHandlers):
self.connection.SendAndCallForResponse(iq, _on_response) self.connection.SendAndCallForResponse(iq, _on_response)
else: else:
self.connection.send(iq) self.connection.send(iq)
gajim.idlequeue.set_alarm(self.check_keepalive, gajim.config.get_per( gajim.idlequeue.set_alarm(self.check_pingalive, gajim.config.get_per(
'accounts', self.name, 'time_for_keep_alive_answer')) 'accounts', self.name, 'time_for_ping_alive_answer'))
def get_active_default_lists(self): def get_active_default_lists(self):
if not self.connection: if not self.connection:
@ -1024,7 +1030,7 @@ class Connection(ConnectionHandlers):
if not self.connection: if not self.connection:
return return
self.connection.set_send_timeout(self.keepalives, self.send_keepalive) self.connection.set_send_timeout(self.keepalives, self.send_keepalive)
self.connection.set_send_timeout2(self.keepalives * 2, self.sendPing) self.connection.set_send_timeout2(self.pingalives, self.sendPing)
self.connection.onreceive(None) self.connection.onreceive(None)
iq = common.xmpp.Iq('get', common.xmpp.NS_PRIVACY, xmlns = '') iq = common.xmpp.Iq('get', common.xmpp.NS_PRIVACY, xmlns = '')
id_ = self.connection.getAnID() id_ = self.connection.getAnID()
@ -1898,7 +1904,7 @@ class Connection(ConnectionHandlers):
c.setTagData('reason', reason) c.setTagData('reason', reason)
self.connection.send(message) self.connection.send(message)
def check_keepalive(self): def check_pingalive(self):
if self.awaiting_xmpp_ping_id: if self.awaiting_xmpp_ping_id:
# We haven't got the pong in time, disco and reconnect # We haven't got the pong in time, disco and reconnect
self._disconnectedReconnCB() self._disconnectedReconnCB()