Don't filter out own device when sending OMEMO message
This commit is contained in:
parent
9653636d92
commit
1dfdb36d20
@ -18,6 +18,7 @@
|
|||||||
- New config setting [locked_muc_nickname](https://conversejs.org/docs/html/configuration.html#locked-muc-nickname)
|
- New config setting [locked_muc_nickname](https://conversejs.org/docs/html/configuration.html#locked-muc-nickname)
|
||||||
- New config setting [show_client_info](https://conversejs.org/docs/html/configuration.html#show-client-info)
|
- New config setting [show_client_info](https://conversejs.org/docs/html/configuration.html#show-client-info)
|
||||||
- Document new API method [sendMessage](https://conversejs.org/docs/html/api/-_converse.ChatBox.html#sendMessage)
|
- Document new API method [sendMessage](https://conversejs.org/docs/html/api/-_converse.ChatBox.html#sendMessage)
|
||||||
|
- Don't filter out own device when sending an OMEMO message
|
||||||
- #1149: With `xhr_user_search_url`, contact requests are not being sent out
|
- #1149: With `xhr_user_search_url`, contact requests are not being sent out
|
||||||
- #1213: Switch roster filter input and icons
|
- #1213: Switch roster filter input and icons
|
||||||
- #1327: fix False mentions positives in URLs and Email addresses
|
- #1327: fix False mentions positives in URLs and Email addresses
|
||||||
|
7
dist/converse.js
vendored
7
dist/converse.js
vendored
@ -56624,17 +56624,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
|||||||
_converse.getBundlesAndBuildSessions = async function (chatbox) {
|
_converse.getBundlesAndBuildSessions = async function (chatbox) {
|
||||||
let devices;
|
let devices;
|
||||||
|
|
||||||
const id = _converse.omemo_store.get('device_id');
|
|
||||||
|
|
||||||
if (chatbox.get('type') === _converse.CHATROOMS_TYPE) {
|
if (chatbox.get('type') === _converse.CHATROOMS_TYPE) {
|
||||||
const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid'))));
|
const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid'))));
|
||||||
devices = collections.reduce((a, b) => _.concat(a, b.models), []);
|
devices = collections.reduce((a, b) => _.concat(a, b.models), []);
|
||||||
} else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) {
|
} else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) {
|
||||||
const their_devices = await getDevicesForContact(chatbox.get('jid')),
|
const their_devices = await getDevicesForContact(chatbox.get('jid')),
|
||||||
devicelist = _converse.devicelists.get(_converse.bare_jid),
|
own_devices = _converse.devicelists.get(_converse.bare_jid).devices;
|
||||||
own_devices = devicelist.devices;
|
|
||||||
|
|
||||||
devices = _.concat(own_devices, their_devices.models);
|
devices = _.concat(own_devices.models, their_devices.models);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(devices.map(d => d.getBundle()));
|
await Promise.all(devices.map(d => d.getBundle()));
|
||||||
|
@ -179,6 +179,7 @@
|
|||||||
`<encrypted xmlns="eu.siacs.conversations.axolotl">`+
|
`<encrypted xmlns="eu.siacs.conversations.axolotl">`+
|
||||||
`<header sid="123456789">`+
|
`<header sid="123456789">`+
|
||||||
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`+
|
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`+
|
||||||
|
`<key rid="123456789">YzFwaDNSNzNYNw==</key>`+
|
||||||
`<key rid="555">YzFwaDNSNzNYNw==</key>`+
|
`<key rid="555">YzFwaDNSNzNYNw==</key>`+
|
||||||
`<iv>${sent_stanza.nodeTree.querySelector("iv").textContent}</iv>`+
|
`<iv>${sent_stanza.nodeTree.querySelector("iv").textContent}</iv>`+
|
||||||
`</header>`+
|
`</header>`+
|
||||||
@ -258,6 +259,7 @@
|
|||||||
toggle.click();
|
toggle.click();
|
||||||
expect(view.model.get('omemo_active')).toBe(true);
|
expect(view.model.get('omemo_active')).toBe(true);
|
||||||
|
|
||||||
|
// newguy enters the room
|
||||||
const contact_jid = 'newguy@localhost';
|
const contact_jid = 'newguy@localhost';
|
||||||
let stanza = $pres({
|
let stanza = $pres({
|
||||||
'to': 'dummy@localhost/resource',
|
'to': 'dummy@localhost/resource',
|
||||||
@ -271,6 +273,7 @@
|
|||||||
}).tree();
|
}).tree();
|
||||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||||
|
|
||||||
|
// Wait for Converse to fetch newguy's device list
|
||||||
let iq_stanza = await test_utils.waitUntil(() => deviceListFetched(_converse, contact_jid));
|
let iq_stanza = await test_utils.waitUntil(() => deviceListFetched(_converse, contact_jid));
|
||||||
expect(iq_stanza.toLocaleString()).toBe(
|
expect(iq_stanza.toLocaleString()).toBe(
|
||||||
`<iq from="dummy@localhost" id="${iq_stanza.nodeTree.getAttribute("id")}" to="${contact_jid}" type="get" xmlns="jabber:client">`+
|
`<iq from="dummy@localhost" id="${iq_stanza.nodeTree.getAttribute("id")}" to="${contact_jid}" type="get" xmlns="jabber:client">`+
|
||||||
@ -279,6 +282,7 @@
|
|||||||
`</pubsub>`+
|
`</pubsub>`+
|
||||||
`</iq>`);
|
`</iq>`);
|
||||||
|
|
||||||
|
// The server returns his device list
|
||||||
stanza = $iq({
|
stanza = $iq({
|
||||||
'from': contact_jid,
|
'from': contact_jid,
|
||||||
'id': iq_stanza.nodeTree.getAttribute('id'),
|
'id': iq_stanza.nodeTree.getAttribute('id'),
|
||||||
@ -366,6 +370,7 @@
|
|||||||
`<encrypted xmlns="eu.siacs.conversations.axolotl">`+
|
`<encrypted xmlns="eu.siacs.conversations.axolotl">`+
|
||||||
`<header sid="123456789">`+
|
`<header sid="123456789">`+
|
||||||
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`+
|
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`+
|
||||||
|
`<key rid="123456789">YzFwaDNSNzNYNw==</key>`+
|
||||||
`<key rid="4e30f35051b7b8b42abe083742187228">YzFwaDNSNzNYNw==</key>`+
|
`<key rid="4e30f35051b7b8b42abe083742187228">YzFwaDNSNzNYNw==</key>`+
|
||||||
`<iv>${sent_stanza.nodeTree.querySelector("iv").textContent}</iv>`+
|
`<iv>${sent_stanza.nodeTree.querySelector("iv").textContent}</iv>`+
|
||||||
`</header>`+
|
`</header>`+
|
||||||
|
@ -549,20 +549,14 @@ converse.plugins.add('converse-omemo', {
|
|||||||
|
|
||||||
_converse.getBundlesAndBuildSessions = async function (chatbox) {
|
_converse.getBundlesAndBuildSessions = async function (chatbox) {
|
||||||
let devices;
|
let devices;
|
||||||
const id = _converse.omemo_store.get('device_id');
|
|
||||||
if (chatbox.get('type') === _converse.CHATROOMS_TYPE) {
|
if (chatbox.get('type') === _converse.CHATROOMS_TYPE) {
|
||||||
const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid'))));
|
const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid'))));
|
||||||
devices = collections.reduce((a, b) => _.concat(a, b.models), []);
|
devices = collections.reduce((a, b) => _.concat(a, b.models), []);
|
||||||
|
|
||||||
} else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) {
|
} else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) {
|
||||||
const their_devices = await getDevicesForContact(chatbox.get('jid')),
|
const their_devices = await getDevicesForContact(chatbox.get('jid')),
|
||||||
devicelist = _converse.devicelists.get(_converse.bare_jid),
|
own_devices = _converse.devicelists.get(_converse.bare_jid).devices;
|
||||||
own_devices = devicelist.devices.filter(d => d.get('id') !== id);
|
devices = _.concat(own_devices.models, their_devices.models);
|
||||||
devices = _.concat(own_devices, their_devices.models);
|
|
||||||
}
|
}
|
||||||
// Filter out our own device
|
|
||||||
devices = devices.filter(d => d.get('id') !== id);
|
|
||||||
|
|
||||||
await Promise.all(devices.map(d => d.getBundle()));
|
await Promise.all(devices.map(d => d.getBundle()));
|
||||||
await Promise.all(devices.map(d => getSession(d)));
|
await Promise.all(devices.map(d => getSession(d)));
|
||||||
return devices;
|
return devices;
|
||||||
@ -613,7 +607,7 @@ converse.plugins.add('converse-omemo', {
|
|||||||
// and they are separately encrypted using the
|
// and they are separately encrypted using the
|
||||||
// session corresponding to the counterpart device.
|
// session corresponding to the counterpart device.
|
||||||
stanza.c('encrypted', {'xmlns': Strophe.NS.OMEMO})
|
stanza.c('encrypted', {'xmlns': Strophe.NS.OMEMO})
|
||||||
.c('header', {'sid': _converse.omemo_store.get('device_id')});
|
.c('header', {'sid': _converse.omemo_store.get('device_id')});
|
||||||
|
|
||||||
return chatbox.encryptMessage(message.get('message')).then(obj => {
|
return chatbox.encryptMessage(message.get('message')).then(obj => {
|
||||||
// The 16 bytes key and the GCM authentication tag (The tag
|
// The 16 bytes key and the GCM authentication tag (The tag
|
||||||
|
Loading…
Reference in New Issue
Block a user