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
bd23a775
Commit
bd23a775
authored
May 30, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add processing hints to OTR messages
so that they're not stored in MAM and not forwarded. updates #553
parent
5993fba1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
27 deletions
+57
-27
docs/CHANGES.md
docs/CHANGES.md
+1
-0
spec/chatbox.js
spec/chatbox.js
+0
-18
spec/otr.js
spec/otr.js
+40
-0
src/converse-core.js
src/converse-core.js
+1
-0
src/converse-otr.js
src/converse-otr.js
+4
-1
tests/utils.js
tests/utils.js
+11
-8
No files found.
docs/CHANGES.md
View file @
bd23a775
...
...
@@ -8,6 +8,7 @@
-
Chat bot messages don't appear when they have the same ids as their commands.
[jcbrand]
-
Updated onDisconnected method to fire disconnected event even if auto_reconnect is false. [kamranzafar]
-
#553 Add processing hints to OTR messages [jcbrand]
## 1.0.2 (2016-05-24)
...
...
spec/chatbox.js
View file @
bd23a775
...
...
@@ -934,24 +934,6 @@
}.
bind
(
converse
));
describe
(
"
An OTR Chat Message
"
,
function
()
{
it
(
"
will not be carbon copied when it's sent out
"
,
function
()
{
var
msgtext
=
"
?OTR,1,3,?OTR:AAIDAAAAAAEAAAABAAAAwCQ8HKsag0y0DGKsneo0kzKu1ua5L93M4UKTkCf1I2kbm2RgS5kIxDTxrTj3wVRB+H5Si86E1fKtuBgsDf/bKkGTM0h/49vh5lOD9HkE8cnSrFEn5GN,
"
;
var
sender_jid
=
mock
.
cur_names
[
3
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
converse_api
.
chats
.
open
(
sender_jid
);
var
chatbox
=
converse
.
chatboxes
.
get
(
sender_jid
);
spyOn
(
converse
.
connection
,
'
send
'
);
chatbox
.
set
(
'
otr_status
'
,
1
);
// Set OTR status to UNVERIFIED, to mock an encrypted session
chatbox
.
trigger
(
'
sendMessage
'
,
new
converse
.
Message
({
message
:
msgtext
}));
var
$sent
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$sent
.
find
(
'
body
'
).
siblings
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
attr
(
'
xmlns
'
)).
toBe
(
'
urn:xmpp:carbons:2
'
);
chatbox
.
set
(
'
otr_status
'
,
0
);
// Reset again to UNENCRYPTED
});
});
describe
(
"
A Chat Status Notification
"
,
function
()
{
it
(
"
does not open automatically if a chat state notification is received
"
,
function
()
{
...
...
spec/otr.js
View file @
bd23a775
...
...
@@ -9,9 +9,15 @@
}
);
}
(
this
,
function
(
$
,
mock
,
test_utils
)
{
var
Strophe
=
converse_api
.
env
.
Strophe
;
var
b64_sha1
=
converse_api
.
env
.
b64_sha1
;
return
describe
(
"
The OTR module
"
,
function
()
{
beforeEach
(
function
()
{
test_utils
.
openControlBox
();
test_utils
.
openContactsPanel
();
test_utils
.
createContacts
(
'
current
'
);
});
it
(
"
can store a session passphrase in session storage
"
,
function
()
{
// With no prebind, the user's XMPP password is used and nothing is
...
...
@@ -33,5 +39,39 @@
converse
.
authentication
=
auth
;
converse
.
connection
.
pass
=
pass
;
});
it
(
"
will add processing hints to sent out encrypted <message> stanzas
"
,
function
()
{
var
UNVERIFIED
=
1
,
UNENCRYPTED
=
0
;
var
contact_name
=
mock
.
cur_names
[
0
];
var
contact_jid
=
contact_name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
contact_jid
);
var
chatview
=
converse
.
chatboxviews
.
get
(
contact_jid
);
chatview
.
model
.
set
(
'
otr_status
'
,
UNVERIFIED
);
var
stanza
=
chatview
.
createMessageStanza
(
new
converse
.
Message
({
message
:
'
hello world
'
}));
var
$hints
=
$
(
stanza
.
nodeTree
).
find
(
'
[xmlns="
'
+
Strophe
.
NS
.
HINTS
+
'
"]
'
);
expect
(
$hints
.
length
).
toBe
(
3
);
expect
(
$hints
.
get
(
0
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$hints
.
get
(
1
).
tagName
).
toBe
(
'
no-permanent-store
'
);
expect
(
$hints
.
get
(
2
).
tagName
).
toBe
(
'
no-copy
'
);
chatview
.
model
.
set
(
'
otr_status
'
,
UNENCRYPTED
);
// Reset again to UNENCRYPTED
});
describe
(
"
An OTR Chat Message
"
,
function
()
{
it
(
"
will not be carbon copied when it's sent out
"
,
function
()
{
var
msgtext
=
"
?OTR,1,3,?OTR:AAIDAAAAAAEAAAABAAAAwCQ8HKsag0y0DGKsneo0kzKu1ua5L93M4UKTkCf1I2kbm2RgS5kIxDTxrTj3wVRB+H5Si86E1fKtuBgsDf/bKkGTM0h/49vh5lOD9HkE8cnSrFEn5GN,
"
;
var
sender_jid
=
mock
.
cur_names
[
3
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
converse_api
.
chats
.
open
(
sender_jid
);
var
chatbox
=
converse
.
chatboxes
.
get
(
sender_jid
);
spyOn
(
converse
.
connection
,
'
send
'
);
chatbox
.
set
(
'
otr_status
'
,
1
);
// Set OTR status to UNVERIFIED, to mock an encrypted session
chatbox
.
trigger
(
'
sendMessage
'
,
new
converse
.
Message
({
message
:
msgtext
}));
var
$sent
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$sent
.
find
(
'
body
'
).
siblings
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
length
).
toBe
(
1
);
expect
(
$sent
.
find
(
'
private
'
).
attr
(
'
xmlns
'
)).
toBe
(
'
urn:xmpp:carbons:2
'
);
chatbox
.
set
(
'
otr_status
'
,
0
);
// Reset again to UNENCRYPTED
});
});
});
}));
src/converse-core.js
View file @
bd23a775
...
...
@@ -151,6 +151,7 @@
Strophe
.
addNamespace
(
'
ROSTERX
'
,
'
http://jabber.org/protocol/rosterx
'
);
Strophe
.
addNamespace
(
'
XFORM
'
,
'
jabber:x:data
'
);
Strophe
.
addNamespace
(
'
NICK
'
,
'
http://jabber.org/protocol/nick
'
);
Strophe
.
addNamespace
(
'
HINTS
'
,
'
urn:xmpp:hints
'
);
// Instance level constants
this
.
TIMEOUTS
=
{
// Set as module attr so that we can override in tests.
...
...
src/converse-otr.js
View file @
bd23a775
...
...
@@ -298,7 +298,10 @@
var
stanza
=
this
.
_super
.
createMessageStanza
.
apply
(
this
,
arguments
);
if
(
this
.
model
.
get
(
'
otr_status
'
)
!==
UNENCRYPTED
)
{
// OTR messages aren't carbon copied
stanza
.
c
(
'
private
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CARBONS
});
stanza
.
c
(
'
private
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CARBONS
}).
up
()
.
c
(
'
no-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-permanent-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-copy
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
});
}
return
stanza
;
},
...
...
tests/utils.js
View file @
bd23a775
...
...
@@ -140,7 +140,7 @@
*
* These contacts are not grouped. See below.
*/
var
names
;
var
names
,
jid
;
if
(
type
===
'
requesting
'
)
{
names
=
mock
.
req_names
;
subscription
=
'
none
'
;
...
...
@@ -167,13 +167,16 @@
length
=
names
.
length
;
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
converse
.
roster
.
create
({
ask
:
ask
,
fullname
:
names
[
i
],
jid
:
names
[
i
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
,
requesting
:
requesting
,
subscription
:
subscription
});
jid
=
names
[
i
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
if
(
!
converse
.
roster
.
get
(
jid
))
{
converse
.
roster
.
create
({
'
ask
'
:
ask
,
'
fullname
'
:
names
[
i
],
'
jid
'
:
jid
,
'
requesting
'
:
requesting
,
'
subscription
'
:
subscription
});
}
}
return
this
;
};
...
...
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