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
ccfccfb2
Commit
ccfccfb2
authored
Aug 30, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle case where buddy starts OTR better.
parent
48b6898a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
26 deletions
+29
-26
converse.js
converse.js
+29
-26
No files found.
converse.js
View file @
ccfccfb2
...
...
@@ -305,14 +305,13 @@
return
myKey
;
},
initiateOTR
:
function
(
myKey
)
{
var
options
=
{
initiateOTR
:
function
()
{
this
.
otr
=
new
otr
.
OTR
(
{
fragment_size
:
140
,
send_interval
:
200
,
priv
:
myKey
,
debug
:
true
};
this
.
otr
=
new
otr
.
OTR
(
options
);
priv
:
this
.
getPrivateKey
(),
debug
:
this
.
debug
});
this
.
otr
.
on
(
'
ui
'
,
$
.
proxy
(
function
(
msg
)
{
this
.
trigger
(
'
showReceivedOTRMessage
'
,
msg
);
},
this
));
...
...
@@ -378,10 +377,8 @@
if
(
match
)
{
// They want to initiate OTR
if
(
!
this
.
otr
)
{
// FIXME: this isn't yet correct...
this
.
initiateOTR
();
this
.
trigger
(
'
buddyStartsOTR
'
);
}
this
.
otr
.
receiveMsg
(
match
[
0
]);
}
else
{
// Normal unencrypted message.
this
.
createMessage
(
message
);
...
...
@@ -403,7 +400,7 @@
'
click .close-chatbox-button
'
:
'
closeChat
'
,
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
,
'
click .toggle-otr
'
:
'
toggleOTRMenu
'
,
'
click .start-otr
'
:
'
startOTR
'
,
'
click .start-otr
'
:
'
startOTR
FromToolbar
'
,
'
click .end-otr
'
:
'
endOTR
'
,
'
click .auth-otr
'
:
'
authOTR
'
},
...
...
@@ -420,7 +417,7 @@
'
<form class="sendXMPPMessage" action="" method="post">
'
+
'
<ul class="chat-toolbar no-text-select">
'
+
'
<li class="toggle-otr not-private" title="Turn on
\'
off-the-record
\'
chat encryption">
'
+
'
<span class="chat-toolbar-text">
Not private
</span>
'
+
'
<span class="chat-toolbar-text">
Unencrypted
</span>
'
+
'
<span class="icon-unlocked"></span>
'
+
'
<ul>
'
+
'
<li><a class="start-otr" href="#">Start private conversation</a></li>
'
+
...
...
@@ -457,6 +454,7 @@
this
.
model
.
on
(
'
show
'
,
this
.
show
,
this
);
this
.
model
.
on
(
'
destroy
'
,
this
.
hide
,
this
);
this
.
model
.
on
(
'
change
'
,
this
.
onChange
,
this
);
this
.
model
.
on
(
'
buddyStartsOTR
'
,
this
.
buddyStartsOTR
,
this
);
this
.
model
.
on
(
'
sendMessageStanza
'
,
this
.
sendMessageStanza
,
this
);
this
.
model
.
on
(
'
showSentOTRMessage
'
,
function
(
text
)
{
this
.
showOTRMessage
(
text
,
'
me
'
);
...
...
@@ -683,28 +681,33 @@
});
},
startOTR
:
function
(
ev
)
{
$
(
ev
.
target
).
parent
().
parent
().
slideUp
();
ev
.
stopPropagation
();
msgs
=
[
__
(
'
Initializing OTR.
'
),
__
(
'
Generating private key
'
),
__
(
'
...this might take a few seconds.
'
)
];
this
.
showHelpMessages
(
msgs
);
startOTR
:
function
(
message
)
{
this
.
showHelpMessages
([
message
,
__
(
'
Hold on, generating private key.
'
)
]);
setTimeout
(
$
.
proxy
(
function
()
{
var
privKey
=
this
.
model
.
getPrivateKey
();
msgs
=
[
__
(
'
Private key generated.
'
)
];
this
.
showHelpMessages
(
msgs
);
this
.
model
.
initiateOTR
(
privKey
);
this
.
model
.
initiateOTR
();
this
.
showHelpMessages
([
__
(
'
Private key generated.
'
)]);
},
this
));
// TODO: UI must be updated to show new status... most likely
// "unverified" but we also need to figure out to know whether
// the status is verified or unverified (and how to verify).
},
buddyStartsOTR
:
function
(
ev
)
{
this
.
showHelpMessages
([
__
(
this
.
model
.
get
(
'
fullname
'
)
+
'
has requested an encrypted session.
'
)
]);
this
.
startOTR
();
},
startOTRFromToolbar
:
function
(
ev
)
{
$
(
ev
.
target
).
parent
().
parent
().
slideUp
();
ev
.
stopPropagation
();
this
.
startOTR
();
},
endOTR
:
function
(
ev
)
{
alert
(
'
to be done
'
);
},
...
...
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