Commit 21a3b440 authored by JC Brand's avatar JC Brand

Don't send CSI or auto_away/xa stanzas when not auth'd

This is to deal with reconnects. Originally @thierrytiti checked for
`connection.connected` but I think that might still pose a problem when
reconnecting is in process and the user is not yet authenticated again.

This makes pull request #426 unnecessary.
parent 952b5098
......@@ -426,10 +426,15 @@
};
this.onUserActivity = function () {
/* Reset counters and flags relating to user activity. */
/* Resets counters and flags relating to CSI and auto_away/auto_xa */
if (this.idle_seconds > 0) {
this.idle_seconds = 0;
}
if (!converse.connection.authenticated) {
// We can't send out any stanzas when there's no authenticated connection.
// This can happen when the connection reconnects.
return;
}
if (this.inactive) {
this.sendCSI(ACTIVE);
}
......@@ -440,7 +445,15 @@
};
this.onEverySecond = function () {
/* An interval handler running every second */
/* An interval handler running every second.
* Used for CSI and the auto_away and auto_xa
* features.
*/
if (!converse.connection.authenticated) {
// We can't send out any stanzas when there's no authenticated connection.
// This can happen when the connection reconnects.
return;
}
var stat = this.xmppstatus.getStatus();
this.idle_seconds++;
if (this.idle_seconds > this.csi_waiting_time && !this.inactive) {
......
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