Merge pull request #503 from teseo/master
Fix roster push when new contact is pushed from server and emit rosterPush event
This commit is contained in:
commit
cf25670ccb
@ -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,6 +4375,9 @@
|
||||
$(iq).children('query').find('item').each(function (idx, item) {
|
||||
this.updateContact(item);
|
||||
}.bind(this));
|
||||
|
||||
converse.emit('rosterPush', iq);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
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) { ... });`` |
|
||||
|
Loading…
Reference in New Issue
Block a user