Commit ea701f38 authored by JC Brand's avatar JC Brand

updates #493

Compare bare JID of from attr in roster update. @teseo's fix was too specific
and tailored for a misbehaving server (servers shouldn't be sending from the
full JID in a roster push).
parent 341d5e74
......@@ -4451,8 +4451,11 @@
*/
var id = iq.getAttribute('id');
var from = iq.getAttribute('from');
if (from && from !== "" && from !== converse.connection.jid) {
if (from && from !== "" && Strophe.getBareJidFromJid(from) !== converse.bare_jid) {
// Receiving client MUST ignore stanza unless it has no from or from = user's bare JID.
// XXX: Some naughty servers apparently send from a full
// JID so we need to explicitly compare bare jids here.
// https://github.com/jcbrand/converse.js/issues/493
converse.connection.send(
$iq({type: 'error', id: id, from: converse.connection.jid})
.c('error', {'type': 'cancel'})
......@@ -4466,8 +4469,7 @@
}.bind(this));
converse.emit('rosterPush', iq);
return true;
return true;
},
fetchFromServer: function (callback, errback) {
......
......@@ -5,7 +5,8 @@ Changelog
------------------
* #459 Wrong datatype passed to converse.chatboxes.getChatBox. [hobblegobber, jcbrand]
* #493 Refactor previous bugfix and now an event is emitted when a roster push event from server happens. [teseo]
* #493 Roster push fix [jcbrand]
* #403 emit an event ``rosterPush`` when a roster push happens [teseo]
* #502. Chat room not opened in non_amd version. [rjanbiah]
* #505 Typo caused [object Object] in room info [gromiak]
* #508 "Is typing" doesn't automatically disappear [jcbrand]
......
......@@ -195,7 +195,8 @@
* </iq>
*/
spyOn(converse.roster, "updateContact").andCallThrough();
stanza = $iq({'type': 'set'}).c('query', {'xmlns': 'jabber:iq:roster'})
stanza = $iq({'type': 'set', 'from': 'dummy@localhost'})
.c('query', {'xmlns': 'jabber:iq:roster'})
.c('item', {
'jid': 'contact@example.org',
'subscription': 'none',
......
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