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
ec85490f
Commit
ec85490f
authored
Aug 02, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow configuration of which XEP-0095 CSN's may be sent out
parent
550d0ae3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
2 deletions
+41
-2
docs/source/configuration.rst
docs/source/configuration.rst
+13
-2
spec/chatbox.js
spec/chatbox.js
+24
-0
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+4
-0
No files found.
docs/source/configuration.rst
View file @
ec85490f
...
@@ -1403,8 +1403,19 @@ send_chat_state_notifications
...
@@ -1403,8 +1403,19 @@ send_chat_state_notifications
* Default: ``true``
* Default: ``true``
Determines whether chat state notifications (see `XEP-0085 <https://xmpp.org/extensions/xep-0085.html>`_)
Determines whether chat state notifications (see `XEP-0085 <https://xmpp.org/extensions/xep-0085.html>`_) should be sent out or not.
should be sent out or not.
Can also be set to an Array in order to allow only certain types of chat state notifications.
For example:
.. code-block:: javascript
converse.initialize({
'send_chat_state_notifications': ['composing']
});
Valid values are ``'active', 'composing', 'gone' 'inactive', 'paused'``
show_images_inline
show_images_inline
------------------
------------------
...
...
spec/chatbox.js
View file @
ec85490f
...
@@ -715,6 +715,30 @@
...
@@ -715,6 +715,30 @@
done
();
done
();
}));
}));
it
(
"
is NOT sent out if send_chat_state_notifications doesn't allow it
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{
'
send_chat_state_notifications
'
:
[]},
async
function
(
done
,
_converse
)
{
await
test_utils
.
waitForRoster
(
_converse
,
'
current
'
);
test_utils
.
openControlBox
();
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@montague.lit
'
;
await
u
.
waitUntil
(()
=>
_converse
.
rosterview
.
el
.
querySelectorAll
(
'
.roster-group
'
).
length
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
var
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
active
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
).
and
.
callThrough
();
view
.
onKeyDown
({
target
:
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
),
keyCode
:
1
});
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
expect
(
_converse
.
connection
.
send
).
not
.
toHaveBeenCalled
();
done
();
}));
it
(
"
will be shown if received
"
,
it
(
"
will be shown if received
"
,
mock
.
initConverse
(
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
...
...
src/headless/converse-chatboxes.js
View file @
ec85490f
...
@@ -748,6 +748,10 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -748,6 +748,10 @@ converse.plugins.add('converse-chatboxes', {
*/
*/
sendChatState
()
{
sendChatState
()
{
if
(
_converse
.
send_chat_state_notifications
&&
this
.
get
(
'
chat_state
'
))
{
if
(
_converse
.
send_chat_state_notifications
&&
this
.
get
(
'
chat_state
'
))
{
const
allowed
=
_converse
.
send_chat_state_notifications
;
if
(
Array
.
isArray
(
allowed
)
&&
!
allowed
.
includes
(
this
.
get
(
'
chat_state
'
)))
{
return
;
}
_converse
.
api
.
send
(
_converse
.
api
.
send
(
$msg
({
$msg
({
'
id
'
:
_converse
.
connection
.
getUniqueId
(),
'
id
'
:
_converse
.
connection
.
getUniqueId
(),
...
...
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