Fixes #790 mam retrieval broken

This commit is contained in:
JC Brand 2017-02-25 09:53:36 +01:00
parent 2c8b31c19d
commit adb4f62ea9
2 changed files with 4 additions and 3 deletions

View File

@ -58,7 +58,7 @@
- #694 The `notification_option` wasn't being used consistently. [jcbrand]
- #745 New config option [priority](https://conversejs.org/docs/html/configuration.html#priority) [jcbrand]
- #770 Allow setting contact attrs on chats.open [Ape]
- #790 MAM retrieval broken [jcbrand]
## 2.0.6 (2017-02-13)
- Escape user-generated input to prevent JS-injection attacks. (Thanks to SamWhited) [jcbrand]

View File

@ -1476,7 +1476,8 @@
chatbox, resource,
from_jid = message.getAttribute('from'),
to_jid = message.getAttribute('to'),
to_resource = Strophe.getResourceFromJid(to_jid);
to_resource = Strophe.getResourceFromJid(to_jid),
is_carbon = !_.isNull(message.querySelector('received[xmlns="'+Strophe.NS.CARBONS+'"]'));
if (_converse.filter_by_resource && (to_resource && to_resource !== _converse.resource)) {
_converse.log(
@ -1498,7 +1499,7 @@
if (!_.isNull(forwarded)) {
var forwarded_message = forwarded.querySelector('message');
var forwarded_from = forwarded_message.getAttribute('from');
if (Strophe.getBareJidFromJid(forwarded_from) !== from_jid) {
if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) {
// Prevent message forging via carbons
//
// https://xmpp.org/extensions/xep-0280.html#security