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
e94904e4
Commit
e94904e4
authored
Feb 14, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't play sound notifications for...
OTR messages which are setting up an encrypted session.
parent
e27dfa06
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
20 deletions
+51
-20
docs/CHANGES.md
docs/CHANGES.md
+8
-3
src/converse-core.js
src/converse-core.js
+23
-14
src/converse-otr.js
src/converse-otr.js
+20
-3
No files found.
docs/CHANGES.md
View file @
e94904e4
# Changelog
## 0.1
0.2
(Unreleased)
## 0.1
1.0
(Unreleased)
-
#261 show_controlbox_by_default config not working [diditopher]
-
#573 xgettext build error:
`'javascript' unknown`
-
Split converse.js into different modules. The code for the OTR and MUC
features are now in separate modules and these can be removed completely from
the build. [jcbrand]
-
Don't play sound notifications for OTR messages which are setting up an
encrypted session. [jcbrand]
-
Save scroll position on minimize and restore it on maximize [rlanvin]
-
#261 show_controlbox_by_default config not working [diditopher]
-
#566 Do not steal the focus when the chatbox opens automatically [rlanvin]
-
#573 xgettext build error:
`'javascript' unknown`
[jcbrand]
## 0.10.1 (2016-02-06)
...
...
src/converse-core.js
View file @
e94904e4
...
...
@@ -955,6 +955,28 @@
});
},
isOnlyChatStateNotification
:
function
(
$msg
)
{
// See XEP-0085 Chat State Notification
return
(
$msg
.
find
(
'
body
'
).
length
===
0
&&
(
$msg
.
find
(
ACTIVE
).
length
!==
0
||
$msg
.
find
(
COMPOSING
).
length
!==
0
||
$msg
.
find
(
INACTIVE
).
length
!==
0
||
$msg
.
find
(
PAUSED
).
length
!==
0
||
$msg
.
find
(
GONE
).
length
!==
0
)
);
},
shouldPlayNotification
:
function
(
$message
)
{
var
$forwarded
=
$message
.
find
(
'
forwarded
'
);
if
(
$forwarded
.
length
)
{
return
false
;
}
var
is_me
=
Strophe
.
getBareJidFromJid
(
$message
.
attr
(
'
from
'
))
===
converse
.
bare_jid
;
return
!
this
.
isOnlyChatStateNotification
(
$message
)
&&
!
is_me
;
},
createMessage
:
function
(
$message
,
$delay
,
archive_id
)
{
$delay
=
$delay
||
$message
.
find
(
'
delay
'
);
var
body
=
$message
.
children
(
'
body
'
).
text
(),
...
...
@@ -2313,19 +2335,6 @@
});
},
isOnlyChatStateNotification
:
function
(
$msg
)
{
// See XEP-0085 Chat State Notification
return
(
$msg
.
find
(
'
body
'
).
length
===
0
&&
(
$msg
.
find
(
ACTIVE
).
length
!==
0
||
$msg
.
find
(
COMPOSING
).
length
!==
0
||
$msg
.
find
(
INACTIVE
).
length
!==
0
||
$msg
.
find
(
PAUSED
).
length
!==
0
||
$msg
.
find
(
GONE
).
length
!==
0
)
);
},
onMessage
:
function
(
message
)
{
/* Handler method for all incoming single-user chat "message" stanzas.
*/
...
...
@@ -2374,7 +2383,7 @@
if
(
msgid
&&
chatbox
.
messages
.
findWhere
({
msgid
:
msgid
}))
{
return
true
;
// We already have this message stored.
}
if
(
!
this
.
isOnlyChatStateNotification
(
$message
)
&&
!
is_me
&&
!
$forwarded
.
length
)
{
if
(
chatbox
.
shouldPlayNotification
(
$message
)
)
{
converse
.
playNotification
();
}
chatbox
.
createMessage
(
$message
,
$delay
,
archive_id
);
...
...
src/converse-otr.js
View file @
e94904e4
...
...
@@ -109,10 +109,27 @@
}
},
isOTRMessage
:
function
(
$message
)
{
var
$body
=
$message
.
children
(
'
body
'
),
text
=
(
$body
.
length
>
0
?
$body
.
text
()
:
undefined
);
return
!!
text
.
match
(
/^
\?
OTR/
);
},
shouldPlayNotification
:
function
(
$message
)
{
/* Don't play a notification if this is an OTR message but
* encryption is not yet set up. That would mean that the
* OTR session is still being established, so there are no
* "visible" OTR messages being exchanged.
*/
return
this
.
_super
.
shouldPlayNotification
.
apply
(
this
,
arguments
)
&&
!
(
this
.
isOTRMessage
(
$message
)
&&
!
_
.
contains
([
UNVERIFIED
,
VERIFIED
],
this
.
get
(
'
otr_status
'
)));
},
createMessage
:
function
(
$message
,
$delay
,
archive_id
)
{
var
converse
=
this
.
_super
.
converse
;
var
$body
=
$message
.
children
(
'
body
'
);
var
text
=
(
$body
.
length
>
0
?
$body
.
text
()
:
undefined
);
var
converse
=
this
.
_super
.
converse
,
$body
=
$message
.
children
(
'
body
'
),
text
=
(
$body
.
length
>
0
?
$body
.
text
()
:
undefined
);
if
((
!
text
)
||
(
!
converse
.
allow_otr
))
{
return
this
.
_super
.
createMessage
.
apply
(
this
,
arguments
);
}
...
...
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