Only fetch presences when we're resuming an existing session.
updates #555
This commit is contained in:
parent
a7184fab41
commit
a656750459
@ -87,7 +87,6 @@ converse.plugins.add('converse-bosh', {
|
|||||||
_converse.log(
|
_converse.log(
|
||||||
"Could not restore session for jid: "+
|
"Could not restore session for jid: "+
|
||||||
jid+" Error message: "+e.message, Strophe.LogLevel.WARN);
|
jid+" Error message: "+e.message, Strophe.LogLevel.WARN);
|
||||||
_converse.clearSession(); // We want to clear presences (see #555)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,6 +323,16 @@ function isTestEnv () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_converse.haveResumed = function () {
|
||||||
|
if (_converse.api.connection.isType('bosh')) {
|
||||||
|
return _converse.connfeedback.get('connection_status') === Strophe.Status.ATTACHED;
|
||||||
|
} else {
|
||||||
|
// XXX: Not binding means that the session was resumed.
|
||||||
|
// This seems very fragile. Perhaps a better way is possible.
|
||||||
|
return !_converse.connection.do_bind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_converse.isUniView = function () {
|
_converse.isUniView = function () {
|
||||||
/* We distinguish between UniView and MultiView instances.
|
/* We distinguish between UniView and MultiView instances.
|
||||||
*
|
*
|
||||||
|
@ -965,7 +965,12 @@ converse.plugins.add('converse-roster', {
|
|||||||
}
|
}
|
||||||
_converse.presences.browserStorage =
|
_converse.presences.browserStorage =
|
||||||
new BrowserStorage.session(`converse.presences-${_converse.bare_jid}`);
|
new BrowserStorage.session(`converse.presences-${_converse.bare_jid}`);
|
||||||
|
|
||||||
|
if (_converse.haveResumed()) {
|
||||||
_converse.presences.fetch();
|
_converse.presences.fetch();
|
||||||
|
} else {
|
||||||
|
_converse.presences.browserStorage._clear();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Triggered once the _converse.Presences collection has been
|
* Triggered once the _converse.Presences collection has been
|
||||||
* initialized and its cached data fetched.
|
* initialized and its cached data fetched.
|
||||||
|
Loading…
Reference in New Issue
Block a user