diff --git a/CHANGES.md b/CHANGES.md index a2edf7f6c..984e29a51 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ - 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) - 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 - #1213: Switch roster filter input and icons - #1327: fix False mentions positives in URLs and Email addresses diff --git a/dist/converse.js b/dist/converse.js index a532d6c45..76657b961 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -56624,17 +56624,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins _converse.getBundlesAndBuildSessions = async function (chatbox) { let devices; - const id = _converse.omemo_store.get('device_id'); - if (chatbox.get('type') === _converse.CHATROOMS_TYPE) { const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid')))); devices = collections.reduce((a, b) => _.concat(a, b.models), []); } else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) { const their_devices = await getDevicesForContact(chatbox.get('jid')), - devicelist = _converse.devicelists.get(_converse.bare_jid), - own_devices = devicelist.devices; + own_devices = _converse.devicelists.get(_converse.bare_jid).devices; - devices = _.concat(own_devices, their_devices.models); + devices = _.concat(own_devices.models, their_devices.models); } await Promise.all(devices.map(d => d.getBundle())); diff --git a/spec/omemo.js b/spec/omemo.js index fc0c3641d..efa547f5a 100644 --- a/spec/omemo.js +++ b/spec/omemo.js @@ -179,6 +179,7 @@ ``+ `
`+ `YzFwaDNSNzNYNw==`+ + `YzFwaDNSNzNYNw==`+ `YzFwaDNSNzNYNw==`+ `${sent_stanza.nodeTree.querySelector("iv").textContent}`+ `
`+ @@ -258,6 +259,7 @@ toggle.click(); expect(view.model.get('omemo_active')).toBe(true); + // newguy enters the room const contact_jid = 'newguy@localhost'; let stanza = $pres({ 'to': 'dummy@localhost/resource', @@ -271,6 +273,7 @@ }).tree(); _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)); expect(iq_stanza.toLocaleString()).toBe( ``+ @@ -279,6 +282,7 @@ ``+ ``); + // The server returns his device list stanza = $iq({ 'from': contact_jid, 'id': iq_stanza.nodeTree.getAttribute('id'), @@ -366,6 +370,7 @@ ``+ `
`+ `YzFwaDNSNzNYNw==`+ + `YzFwaDNSNzNYNw==`+ `YzFwaDNSNzNYNw==`+ `${sent_stanza.nodeTree.querySelector("iv").textContent}`+ `
`+ diff --git a/src/converse-omemo.js b/src/converse-omemo.js index af09f44f6..91037614d 100644 --- a/src/converse-omemo.js +++ b/src/converse-omemo.js @@ -549,20 +549,14 @@ converse.plugins.add('converse-omemo', { _converse.getBundlesAndBuildSessions = async function (chatbox) { let devices; - const id = _converse.omemo_store.get('device_id'); if (chatbox.get('type') === _converse.CHATROOMS_TYPE) { const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid')))); devices = collections.reduce((a, b) => _.concat(a, b.models), []); - } else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) { const their_devices = await getDevicesForContact(chatbox.get('jid')), - devicelist = _converse.devicelists.get(_converse.bare_jid), - own_devices = devicelist.devices.filter(d => d.get('id') !== id); - devices = _.concat(own_devices, their_devices.models); + own_devices = _converse.devicelists.get(_converse.bare_jid).devices; + devices = _.concat(own_devices.models, 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 => getSession(d))); return devices; @@ -613,7 +607,7 @@ converse.plugins.add('converse-omemo', { // and they are separately encrypted using the // session corresponding to the counterpart device. 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 => { // The 16 bytes key and the GCM authentication tag (The tag