Emit an event when the roster is fetched from the cache
We already emit an event when the roster is fetched from the XMPP server, similarly, it would be useful to know when the roster was instead fetched from the cache.
This commit is contained in:
parent
f9528e7144
commit
f60a0512d9
@ -798,6 +798,15 @@ Event Types
|
|||||||
|
|
||||||
Here are the different events that are emitted:
|
Here are the different events that are emitted:
|
||||||
|
|
||||||
|
cachedRoster
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The contacts roster has been retrieved from the local cache (`sessionStorage`).
|
||||||
|
|
||||||
|
``converse.listen.on('cachedRoster', function (event, items) { ... });``
|
||||||
|
|
||||||
|
See also the `roster` event further down.
|
||||||
|
|
||||||
callButtonClicked
|
callButtonClicked
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -937,10 +946,13 @@ After the user has sent out a direct invitation, to a roster contact, asking the
|
|||||||
roster
|
roster
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
When the roster is updated.
|
When the roster has been received from the XMPP server.
|
||||||
|
|
||||||
``converse.listen.on('roster', function (event, items) { ... });``
|
``converse.listen.on('roster', function (event, items) { ... });``
|
||||||
|
|
||||||
|
See also the `cachedRoster` event further up, which gets called instead of
|
||||||
|
`roster` if its already in `sessionStorage`.
|
||||||
|
|
||||||
rosterPush
|
rosterPush
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -358,6 +358,8 @@
|
|||||||
}
|
}
|
||||||
if (converse.auto_changed_status === true) {
|
if (converse.auto_changed_status === true) {
|
||||||
converse.auto_changed_status = false;
|
converse.auto_changed_status = false;
|
||||||
|
// XXX: we should really remember the original state here, and
|
||||||
|
// then set it back to that...
|
||||||
converse.xmppstatus.setStatus(converse.default_state);
|
converse.xmppstatus.setStatus(converse.default_state);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -294,7 +294,9 @@
|
|||||||
*/
|
*/
|
||||||
converse.roster.fetchFromServer(
|
converse.roster.fetchFromServer(
|
||||||
converse.xmppstatus.sendPresence.bind(converse.xmppstatus));
|
converse.xmppstatus.sendPresence.bind(converse.xmppstatus));
|
||||||
} else if (converse.send_initial_presence) {
|
} else {
|
||||||
|
converse.emit('cachedRoster', collection);
|
||||||
|
if (converse.send_initial_presence) {
|
||||||
/* We're not going to fetch the roster again because we have
|
/* We're not going to fetch the roster again because we have
|
||||||
* it already cached in sessionStorage, but we still need to
|
* it already cached in sessionStorage, but we still need to
|
||||||
* send out a presence stanza because this is a new session.
|
* send out a presence stanza because this is a new session.
|
||||||
@ -303,6 +305,7 @@
|
|||||||
converse.xmppstatus.sendPresence();
|
converse.xmppstatus.sendPresence();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user