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
fcd488c4
Commit
fcd488c4
authored
Aug 30, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved UI. The chat toolbar now gives better feedback.
parent
ccfccfb2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
44 deletions
+96
-44
converse.css
converse.css
+2
-2
converse.js
converse.js
+94
-42
No files found.
converse.css
View file @
fcd488c4
...
...
@@ -819,8 +819,8 @@ ul.chat-toolbar {
padding-right
:
3px
;
}
.
not-private
a
,
.
not-private
{
.
unencrypted
a
,
.
unencrypted
{
color
:
#8f2831
;
}
...
...
converse.js
View file @
fcd488c4
...
...
@@ -58,6 +58,10 @@
this
.
xhr_custom_status
=
false
;
this
.
testing
=
false
;
// Exposes sensitive data for testing. Never set to true in production systems!
this
.
callback
=
callback
||
function
()
{};
var
UNENCRYPTED
=
'
unencrypted
'
;
var
UNVERIFIED
=
'
unverified
'
;
var
VERIFIED
=
'
verified
'
;
var
FINISHED
=
'
finished
'
;
// Allow only the whitelisted settings attributes to be overwritten,
// nothing else.
...
...
@@ -286,7 +290,8 @@
'
fullname
'
:
this
.
get
(
'
fullname
'
),
'
url
'
:
this
.
get
(
'
url
'
),
'
image_type
'
:
this
.
get
(
'
image_type
'
),
'
image
'
:
this
.
get
(
'
image
'
)
'
image
'
:
this
.
get
(
'
image
'
),
'
otr_status
'
:
'
unencrypted
'
});
}
},
...
...
@@ -312,6 +317,25 @@
priv
:
this
.
getPrivateKey
(),
debug
:
this
.
debug
});
this
.
otr
.
on
(
'
status
'
,
$
.
proxy
(
function
(
state
)
{
switch
(
state
)
{
case
otr
.
OTR
.
CONST
.
STATUS_AKE_SUCCESS
:
if
(
this
.
otr
.
msgstate
===
otr
.
OTR
.
CONST
.
MSGSTATE_ENCRYPTED
)
{
this
.
set
(
'
otr_status
'
,
UNVERIFIED
);
}
break
;
case
otr
.
OTR
.
CONST
.
STATUS_END_OTR
:
if
(
this
.
otr
.
msgstate
===
otr
.
OTR
.
CONST
.
MSGSTATE_FINISHED
)
{
// XXX: inform the user that his correspondent has closed his end
// of the private connection and the user should do the same
this
.
set
(
'
otr_status
'
,
FINISHED
);
}
else
if
(
this
.
otr
.
msgstate
===
otr
.
OTR
.
CONST
.
MSGSTATE_FINISHED
)
{
this
.
set
(
'
otr_status
'
,
UNENCRYPTED
);
}
break
;
}
},
this
));
this
.
otr
.
on
(
'
ui
'
,
$
.
proxy
(
function
(
msg
)
{
this
.
trigger
(
'
showReceivedOTRMessage
'
,
msg
);
},
this
));
...
...
@@ -415,23 +439,35 @@
'
</div>
'
+
'
<div class="chat-content"></div>
'
+
'
<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">Unencrypted</span>
'
+
'
<ul class="chat-toolbar no-text-select"></ul>
'
+
'
<textarea
'
+
'
type="text"
'
+
'
class="chat-textarea"
'
+
'
placeholder="
'
+
__
(
'
Personal message
'
)
+
'
"/>
'
+
'
</form>
'
),
toolbar_template
:
_
.
template
(
'
<li class="toggle-otr {{otr_status}}" title="{{otr_tooltip}}">
'
+
'
<span class="chat-toolbar-text">{{otr_status}}</span>
'
+
'
{[ if (otr_status == "
'
+
UNENCRYPTED
+
'
") { ]}
'
+
'
<span class="icon-unlocked"></span>
'
+
'
{[ } ]}
'
+
'
{[ if (otr_status == "
'
+
UNVERIFIED
+
'
") { ]}
'
+
'
<span class="icon-lock"></span>
'
+
'
{[ } ]}
'
+
'
{[ if (otr_status == "
'
+
VERIFIED
+
'
") { ]}
'
+
'
<span class="icon-lock"></span>
'
+
'
{[ } ]}
'
+
'
{[ if (otr_status == "
'
+
FINISHED
+
'
") { ]}
'
+
'
<span class="icon-unlocked"></span>
'
+
'
{[ } ]}
'
+
'
<ul>
'
+
'
<li><a class="start-otr" href="#">Start private conversation</a></li>
'
+
'
<li><a class="end-otr" href="#">End private conversation</a></li>
'
+
'
<li><a class="auth-otr" href="#">Authenticate buddy</a></li>
'
+
'
<li><a href="http://www.cypherpunks.ca/otr/help/3.2.0/levels.php" target="_blank">What
\'
s this?</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
+
'
<textarea
'
+
'
type="text"
'
+
'
class="chat-textarea"
'
+
'
placeholder="
'
+
__
(
'
Personal message
'
)
+
'
"/>
'
+
'
</form>
'
),
'
</li>
'
),
message_template
:
_
.
template
(
'
<div class="chat-message {{extra_classes}}">
'
+
...
...
@@ -470,6 +506,13 @@
}
},
render
:
function
()
{
this
.
$el
.
attr
(
'
id
'
,
this
.
model
.
get
(
'
box_id
'
))
.
html
(
this
.
template
(
this
.
model
.
toJSON
()));
this
.
renderToolbar
().
renderAvatar
();
return
this
;
},
showStatusNotification
:
function
(
message
,
replace
)
{
var
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
$chat_content
.
find
(
'
div.chat-event
'
).
remove
().
end
()
...
...
@@ -681,24 +724,19 @@
});
},
startOTR
:
function
(
message
)
{
this
.
showHelpMessages
([
message
,
__
(
'
Hold on, generating private key.
'
)
]);
startOTR
:
function
()
{
// TODO: this should probably only be shown when a private key
// is really being generated. Would have to be via triggered
// event.
this
.
showHelpMessages
([
__
(
'
Hold on, generating a private key.
'
)
]);
setTimeout
(
$
.
proxy
(
function
()
{
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
.
showHelpMessages
([
__
(
'
This user has requested an encrypted session.
'
)]);
this
.
startOTR
();
},
...
...
@@ -731,11 +769,16 @@
this
.
$el
.
find
(
'
div.chat-event
'
).
remove
();
}
}
}
if
(
_
.
has
(
item
.
changed
,
'
status
'
))
{
}
if
(
_
.
has
(
item
.
changed
,
'
status
'
))
{
this
.
showStatusMessage
(
item
.
get
(
'
status
'
));
}
if
(
_
.
has
(
item
.
changed
,
'
image
'
))
{
}
if
(
_
.
has
(
item
.
changed
,
'
image
'
))
{
this
.
renderAvatar
();
}
if
(
_
.
has
(
item
.
changed
,
'
otr_status
'
))
{
this
.
renderToolbar
();
}
// TODO check for changed fullname as well
},
...
...
@@ -773,6 +816,21 @@
}
},
renderToolbar
:
function
()
{
var
data
=
this
.
model
.
toJSON
();
if
(
data
.
otr_status
==
UNENCRYPTED
)
{
data
.
otr_tooltip
=
__
(
'
Your chat message are not encrypted. Click here to enable OTR encryption.
'
);
}
else
if
(
data
.
otr_status
==
UNVERIFIED
){
data
.
otr_tooltip
=
__
(
'
Your chat messages are encrypted, but your buddy has not been verified.
'
);
}
else
if
(
data
.
otr_status
==
VERIFIED
){
data
.
otr_tooltip
=
__
(
'
Your chat messages are encrypted and your buddy verified.
'
);
}
else
if
(
data
.
otr_status
==
FINISHED
){
data
.
otr_tooltip
=
__
(
'
Your buddy has closed their end of the private session, you should do the same
'
);
}
this
.
$el
.
find
(
'
.chat-toolbar
'
).
html
(
this
.
toolbar_template
(
data
));
return
this
;
},
renderAvatar
:
function
()
{
if
(
!
this
.
model
.
get
(
'
image
'
))
{
return
;
...
...
@@ -787,12 +845,6 @@
};
img
.
src
=
img_src
;
this
.
$el
.
find
(
'
.chat-title
'
).
before
(
canvas
);
},
render
:
function
()
{
this
.
$el
.
attr
(
'
id
'
,
this
.
model
.
get
(
'
box_id
'
))
.
html
(
this
.
template
(
this
.
model
.
toJSON
()));
this
.
renderAvatar
();
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