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
cfcab801
Commit
cfcab801
authored
Sep 07, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't inform of unencryptable OMEMO messages unless in debug mode
parent
06352b67
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
src/converse-message-view.js
src/converse-message-view.js
+14
-7
src/converse-notification.js
src/converse-notification.js
+7
-2
src/converse-omemo.js
src/converse-omemo.js
+1
-0
No files found.
src/converse-message-view.js
View file @
cfcab801
...
@@ -131,13 +131,12 @@
...
@@ -131,13 +131,12 @@
_
.
partial
(
u
.
renderImageURL
,
_converse
))(
url
);
_
.
partial
(
u
.
renderImageURL
,
_converse
))(
url
);
}
}
const
encrypted
=
this
.
model
.
get
(
'
encrypted
'
);
let
text
=
this
.
getMessageText
();
let
text
=
encrypted
?
this
.
model
.
get
(
'
plaintext
'
)
:
this
.
model
.
get
(
'
message
'
);
if
(
is_me_message
)
{
text
=
text
.
replace
(
/^
\/
me/
,
''
);
}
const
msg_content
=
msg
.
querySelector
(
'
.chat-msg__text
'
);
const
msg_content
=
msg
.
querySelector
(
'
.chat-msg__text
'
);
if
(
text
!==
url
)
{
if
(
text
&&
text
!==
url
)
{
if
(
is_me_message
)
{
text
=
text
.
replace
(
/^
\/
me/
,
''
);
}
text
=
xss
.
filterXSS
(
text
,
{
'
whiteList
'
:
{}});
text
=
xss
.
filterXSS
(
text
,
{
'
whiteList
'
:
{}});
msg_content
.
innerHTML
=
_
.
flow
(
msg_content
.
innerHTML
=
_
.
flow
(
_
.
partial
(
u
.
geoUriToHttp
,
_
,
_converse
.
geouri_replacement
),
_
.
partial
(
u
.
geoUriToHttp
,
_
,
_converse
.
geouri_replacement
),
...
@@ -217,8 +216,16 @@
...
@@ -217,8 +216,16 @@
this
.
model
.
message_versions_modal
.
show
(
ev
);
this
.
model
.
message_versions_modal
.
show
(
ev
);
},
},
getMessageText
()
{
if
(
this
.
model
.
get
(
'
is_encrypted
'
))
{
return
this
.
model
.
get
(
'
plaintext
'
)
||
(
_converse
.
debug
?
__
(
'
Unencryptable OMEMO message
'
)
:
null
);
}
return
this
.
model
.
get
(
'
message
'
);
},
isMeCommand
()
{
isMeCommand
()
{
const
text
=
this
.
model
.
get
(
'
message
'
);
const
text
=
this
.
getMessageText
(
);
if
(
!
text
)
{
if
(
!
text
)
{
return
false
;
return
false
;
}
}
...
...
src/converse-notification.js
View file @
cfcab801
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
define
([
"
converse-core
"
],
factory
);
define
([
"
converse-core
"
],
factory
);
}(
this
,
function
(
converse
)
{
}(
this
,
function
(
converse
)
{
"
use strict
"
;
"
use strict
"
;
const
{
Strophe
,
_
}
=
converse
.
env
,
const
{
Strophe
,
_
,
sizzle
}
=
converse
.
env
,
u
=
converse
.
env
.
utils
;
u
=
converse
.
env
.
utils
;
converse
.
plugins
.
add
(
'
converse-notification
'
,
{
converse
.
plugins
.
add
(
'
converse-notification
'
,
{
...
@@ -165,8 +165,13 @@
...
@@ -165,8 +165,13 @@
}
}
}
}
}
}
// TODO: we should suppress notifications if we cannot decrypt
// the message...
const
body
=
sizzle
(
`encrypted[xmlns="
${
Strophe
.
NS
.
OMEMO
}
"]`
,
message
).
length
?
__
(
'
OMEMO Message received
'
)
:
message
.
querySelector
(
'
body
'
).
textContent
;
const
n
=
new
Notification
(
title
,
{
const
n
=
new
Notification
(
title
,
{
body
:
message
.
querySelector
(
'
body
'
).
textContent
,
body
:
body
,
lang
:
_converse
.
locale
,
lang
:
_converse
.
locale
,
icon
:
_converse
.
notification_icon
icon
:
_converse
.
notification_icon
});
});
...
...
src/converse-omemo.js
View file @
cfcab801
...
@@ -409,6 +409,7 @@
...
@@ -409,6 +409,7 @@
if
(
this
.
get
(
'
omemo_active
'
)
&&
attrs
.
message
)
{
if
(
this
.
get
(
'
omemo_active
'
)
&&
attrs
.
message
)
{
attrs
[
'
is_encrypted
'
]
=
true
;
attrs
[
'
is_encrypted
'
]
=
true
;
attrs
[
'
plaintext
'
]
=
attrs
.
message
;
const
message
=
this
.
messages
.
create
(
attrs
);
const
message
=
this
.
messages
.
create
(
attrs
);
this
.
getBundlesAndBuildSessions
()
this
.
getBundlesAndBuildSessions
()
.
then
(
devices
=>
this
.
createOMEMOMessageStanza
(
message
,
devices
))
.
then
(
devices
=>
this
.
createOMEMOMessageStanza
(
message
,
devices
))
...
...
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