Commit 97400ed5 authored by JC Brand's avatar JC Brand

Also identify sent carbons as such.

parent b8107afa
...@@ -62583,7 +62583,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha ...@@ -62583,7 +62583,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
// TODO: currently Strophe has no way to register a handler // TODO: currently Strophe has no way to register a handler
// for stanzas without a `type` attribute. // for stanzas without a `type` attribute.
// We could update it to accept null to mean no attribute, // We could update it to accept null to mean no attribute,
// but that would be a backward-incompatible chnge // but that would be a backward-incompatible change
return true; // Gets handled above. return true; // Gets handled above.
} }
...@@ -62716,9 +62716,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha ...@@ -62716,9 +62716,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
if (!_.isNull(forwarded)) { if (!_.isNull(forwarded)) {
const forwarded_message = forwarded.querySelector('message'), const forwarded_message = forwarded.querySelector('message'),
forwarded_from = forwarded_message.getAttribute('from'); forwarded_from = forwarded_message.getAttribute('from'),
is_carbon = !_.isNull(stanza.querySelector(`received[xmlns="${Strophe.NS.CARBONS}"]`)); xmlns = Strophe.NS.CARBONS;
is_mam = sizzle(`message > result[xmlns="${Strophe.NS.MAM}"]`, stanza).length > 0; is_carbon = sizzle(`received[xmlns="${xmlns}"]`, stanza).length > 0;
if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) { if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) {
// Prevent message forging via carbons // Prevent message forging via carbons
...@@ -62726,6 +62726,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha ...@@ -62726,6 +62726,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
return true; return true;
} }
is_mam = sizzle(`message > result[xmlns="${Strophe.NS.MAM}"]`, stanza).length > 0;
stanza = forwarded_message; stanza = forwarded_message;
from_jid = stanza.getAttribute('from'); from_jid = stanza.getAttribute('from');
to_jid = stanza.getAttribute('to'); to_jid = stanza.getAttribute('to');
...@@ -336,7 +336,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -336,7 +336,7 @@ converse.plugins.add('converse-chatboxes', {
}, },
getDuplicateMessage (stanza) { getDuplicateMessage (stanza) {
return this.findDuplicateFromOriginID(stanza) || this.findDuplicateFromStanzaID(stanza); return this.findDuplicateFromOriginID(stanza) || this.findDuplicateFromStanzaID(stanza);
}, },
findDuplicateFromOriginID (stanza) { findDuplicateFromOriginID (stanza) {
...@@ -773,7 +773,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -773,7 +773,7 @@ converse.plugins.add('converse-chatboxes', {
// TODO: currently Strophe has no way to register a handler // TODO: currently Strophe has no way to register a handler
// for stanzas without a `type` attribute. // for stanzas without a `type` attribute.
// We could update it to accept null to mean no attribute, // We could update it to accept null to mean no attribute,
// but that would be a backward-incompatible chnge // but that would be a backward-incompatible change
return true; // Gets handled above. return true; // Gets handled above.
} }
this.onMessage(stanza); this.onMessage(stanza);
...@@ -900,15 +900,15 @@ converse.plugins.add('converse-chatboxes', { ...@@ -900,15 +900,15 @@ converse.plugins.add('converse-chatboxes', {
if (!_.isNull(forwarded)) { if (!_.isNull(forwarded)) {
const forwarded_message = forwarded.querySelector('message'), const forwarded_message = forwarded.querySelector('message'),
forwarded_from = forwarded_message.getAttribute('from'); forwarded_from = forwarded_message.getAttribute('from'),
is_carbon = !_.isNull(stanza.querySelector(`received[xmlns="${Strophe.NS.CARBONS}"]`)); xmlns = Strophe.NS.CARBONS;
is_mam = sizzle(`message > result[xmlns="${Strophe.NS.MAM}"]`, stanza).length > 0; is_carbon = sizzle(`received[xmlns="${xmlns}"]`, stanza).length > 0;
if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) { if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) {
// Prevent message forging via carbons // Prevent message forging via carbons
// https://xmpp.org/extensions/xep-0280.html#security // https://xmpp.org/extensions/xep-0280.html#security
return true; return true;
} }
is_mam = sizzle(`message > result[xmlns="${Strophe.NS.MAM}"]`, stanza).length > 0;
stanza = forwarded_message; stanza = forwarded_message;
from_jid = stanza.getAttribute('from'); from_jid = stanza.getAttribute('from');
to_jid = stanza.getAttribute('to'); to_jid = stanza.getAttribute('to');
......
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