From b82ea5feffc054a3534524792d9d2b9cff7c9575 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 14 Dec 2009 23:39:46 +0100 Subject: [PATCH] restore xmpp ping callback that was removed in [bc039f78321d] Fixes #5510 --- src/common/connection.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/connection.py b/src/common/connection.py index 7a5acf35c..f3e695530 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -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'))