New configuration setting send_chat_markers

Can be used to fine-tune which (if any) of the XEP-0333 chat markers
will be sent out.
This commit is contained in:
JC Brand 2021-01-15 11:11:38 +01:00
parent 26c1c483da
commit c0249b9c28
4 changed files with 18 additions and 3 deletions

View File

@ -12,6 +12,7 @@
- File structure reordering: All plugins are now in `./plugins` folders.
- New configuration setting: [show_tab_notifications](https://conversejs.org/docs/html/configuration.html#show-tab-notifications)
- New configuration setting: [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave)
- New configuration setting: [send_chat_markers](https://conversejs.org/docs/html/configuration.html#send-chat-markers)
- #1823: New config options [mam_request_all_pages](https://conversejs.org/docs/html/configuration.html#mam-request-all-pages)
- Use the MUC stanza id when sending XEP-0333 markers

View File

@ -1802,6 +1802,7 @@ send_chat_state_notifications
-----------------------------
* Default: ``true``
* Allowed values: ``'active', 'composing', 'gone' 'inactive', 'paused'``
Determines whether chat state notifications (see `XEP-0085 <https://xmpp.org/extensions/xep-0085.html>`_) should be sent out or not.
@ -1815,7 +1816,17 @@ For example:
'send_chat_state_notifications': ['composing']
});
Valid values are ``'active', 'composing', 'gone' 'inactive', 'paused'``
send_chat_markers
-----------------
* Default: ``['received', 'displayed', 'acknowledged']``
Determines which (if any) of the `XEP-0333 <https://xmpp.org/extensions/xep-0333.html>`_ chat markers will be sent out.
It's still up to Converse to decide when to send out the relevant markers, the
purpose of this setting is merely to turn on or off the sending of the
individual markers.
show_chat_state_notifications

View File

@ -58,7 +58,8 @@ converse.plugins.add('converse-chat', {
'auto_join_private_chats': [],
'clear_messages_on_reconnection': false,
'filter_by_resource': false,
'send_chat_state_notifications': true
'send_chat_markers': ["received", "displayed", "acknowledged"],
'send_chat_state_notifications': true,
});
_converse.Message = ModelWithContact.extend(MessageMixin);

View File

@ -603,7 +603,9 @@ const ChatBox = ModelWithContact.extend({
* message, even if it didn't include a `markable` element.
*/
sendMarkerForMessage (msg, type='displayed', force=false) {
if (!msg) return;
if (!msg || !api.settings.get('send_chat_markers').includes(type)) {
return;
}
if (msg?.get('is_markable') || force) {
const from_jid = Strophe.getBareJidFromJid(msg.get('from'));
sendMarker(from_jid, msg.get('msgid'), type, msg.get('type'));