restore xmpp ping callback that was removed in [bc039f78321d] Fixes #5510

This commit is contained in:
Yann Leboulanger 2009-12-14 23:39:46 +01:00
parent 15408e8e86
commit b82ea5feff
1 changed files with 6 additions and 1 deletions

View File

@ -1307,6 +1307,11 @@ class Connection(CommonConnection, ConnectionHandlers):
if self.connection:
self.connection.send(' ')
def _on_xmpp_ping_answer(self, iq_obj):
id_ = unicode(iq_obj.getAttr('id'))
if id_ == self.awaiting_xmpp_ping_id:
self.awaiting_xmpp_ping_id = None
def sendPing(self, pingTo=None):
"""
Send XMPP Ping (XEP-0199) request. If pingTo is not set, ping is sent to
@ -1335,7 +1340,7 @@ class Connection(CommonConnection, ConnectionHandlers):
timePing = time_time()
self.connection.SendAndCallForResponse(iq, _on_response)
else:
self.connection.send(iq)
self.connection.SendAndCallForResponse(iq, self._on_xmpp_ping_answer)
gajim.idlequeue.set_alarm(self.check_pingalive, gajim.config.get_per(
'accounts', self.name, 'time_for_ping_alive_answer'))