Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
1dfdb36d
Commit
1dfdb36d
authored
Mar 29, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't filter out own device when sending OMEMO message
parent
9653636d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
14 deletions
+11
-14
CHANGES.md
CHANGES.md
+1
-0
dist/converse.js
dist/converse.js
+2
-5
spec/omemo.js
spec/omemo.js
+5
-0
src/converse-omemo.js
src/converse-omemo.js
+3
-9
No files found.
CHANGES.md
View file @
1dfdb36d
...
...
@@ -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
...
...
dist/converse.js
View file @
1dfdb36d
...
...
@@ -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()));
spec/omemo.js
View file @
1dfdb36d
...
...
@@ -179,6 +179,7 @@
`<encrypted xmlns="eu.siacs.conversations.axolotl">`
+
`<header sid="123456789">`
+
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`
+
`<key rid="123456789">YzFwaDNSNzNYNw==</key>`
+
`<key rid="555">YzFwaDNSNzNYNw==</key>`
+
`<iv>
${
sent_stanza
.
nodeTree
.
querySelector
(
"
iv
"
).
textContent
}
</iv>`
+
`</header>`
+
...
...
@@ -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
(
`<iq from="dummy@localhost" id="
${
iq_stanza
.
nodeTree
.
getAttribute
(
"
id
"
)}
" to="
${
contact_jid
}
" type="get" xmlns="jabber:client">`
+
...
...
@@ -279,6 +282,7 @@
`</pubsub>`
+
`</iq>`
);
// The server returns his device list
stanza
=
$iq
({
'
from
'
:
contact_jid
,
'
id
'
:
iq_stanza
.
nodeTree
.
getAttribute
(
'
id
'
),
...
...
@@ -366,6 +370,7 @@
`<encrypted xmlns="eu.siacs.conversations.axolotl">`
+
`<header sid="123456789">`
+
`<key rid="482886413b977930064a5888b92134fe">YzFwaDNSNzNYNw==</key>`
+
`<key rid="123456789">YzFwaDNSNzNYNw==</key>`
+
`<key rid="4e30f35051b7b8b42abe083742187228">YzFwaDNSNzNYNw==</key>`
+
`<iv>
${
sent_stanza
.
nodeTree
.
querySelector
(
"
iv
"
).
textContent
}
</iv>`
+
`</header>`
+
...
...
src/converse-omemo.js
View file @
1dfdb36d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment