Commit 8665c0ac authored by JC Brand's avatar JC Brand

Bugfix in converse-ping. `this` was wrong context.

parent bc42d50a
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
// New functions which don't exist yet can also be added. // New functions which don't exist yet can also be added.
onConnected: function () { onConnected: function () {
this._super.onConnected().done(this.registerPingHandler); this._super.onConnected().done(converse.registerPingHandler);
}, },
onReconnected: function () { onReconnected: function () {
// We need to re-register the ping event handler on the newly // We need to re-register the ping event handler on the newly
// created connection. // created connection.
this._super.onReconnected().done(this.registerPingHandler); this._super.onReconnected().done(converse.registerPingHandler);
} }
}, },
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
converse.registerPongHandler = function () { converse.registerPongHandler = function () {
converse.connection.disco.addFeature(Strophe.NS.PING); converse.connection.disco.addFeature(Strophe.NS.PING);
converse.connection.ping.addPingHandler(this.pong); converse.connection.ping.addPingHandler(converse.pong);
}; };
converse.registerPingHandler = function () { converse.registerPingHandler = function () {
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
if (!converse.lastStanzaDate) { if (!converse.lastStanzaDate) {
converse.lastStanzaDate = now; converse.lastStanzaDate = now;
} }
if ((now - converse.lastStanzaDate)/1000 > this.ping_interval) { if ((now - converse.lastStanzaDate)/1000 > converse.ping_interval) {
return converse.ping(); return converse.ping();
} }
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment