Commit cf25670c authored by JC Brand's avatar JC Brand

Merge pull request #503 from teseo/master

Fix roster push when new contact is pushed from server and emit rosterPush event
parents b7ea4c29 bef4e26a
......@@ -4362,7 +4362,7 @@
*/
var id = iq.getAttribute('id');
var from = iq.getAttribute('from');
if (from && from !== "" && Strophe.getNodeFromJid(from) != converse.bare_jid) {
if (from && from !== "" && from !== converse.connection.jid) {
// Receiving client MUST ignore stanza unless it has no from or from = user's bare JID.
converse.connection.send(
$iq({type: 'error', id: id, from: converse.connection.jid})
......@@ -4375,7 +4375,10 @@
$(iq).children('query').find('item').each(function (idx, item) {
this.updateContact(item);
}.bind(this));
return true;
converse.emit('rosterPush', iq);
return true;
},
fetchFromServer: function (callback, errback) {
......
Changelog
=========
0.9.7 (Unreleased)
------------------
* #493 Refactor previous bugfix and now an event is emitted when a roster push event from server happens. [teseo]
0.9.6 (2015-10-12)
------------------
......
......@@ -773,6 +773,8 @@ Here are the different events that are emitted:
+---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| **roster** | When the roster is updated. | ``converse.listen.on('roster', function (event, items) { ... });`` |
+---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| **rosterPush** | When the roster receives a push event from server. (i.e. New entry in your buddy list) | ``converse.listen.on('rosterPush', function (event, items) { ... });`` |
+---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| **statusChanged** | When own chat status has changed. | ``converse.listen.on('statusChanged', function (event, status) { ... });`` |
+---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| **statusMessageChanged** | When own custom status message has changed. | ``converse.listen.on('statusMessageChanged', function (event, message) { ... });`` |
......
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