Commit 8c391fe0 authored by JC Brand's avatar JC Brand

Add new config setting enable_muc_push

parent dee10bfe
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
## 4.0.1 (Unreleased) ## 4.0.1 (Unreleased)
- New configuration setting [auto_register_muc_nickname](https://conversejs.org/docs/html/configuration.html#auto-register-muc-nickname) - New config setting [auto_register_muc_nickname](https://conversejs.org/docs/html/configuration.html#auto-register-muc-nickname)
- New config setting [enable_muc_push](https://conversejs.org/docs/html/configuration.html#enable-muc-push)
- #1182 MUC occupants without nick or JID created - #1182 MUC occupants without nick or JID created
- #1184 Notification error when message has no body - #1184 Notification error when message has no body
......
...@@ -630,6 +630,21 @@ If you've run ``make dev``, then these files are also available in ``./node_modu ...@@ -630,6 +630,21 @@ If you've run ``make dev``, then these files are also available in ``./node_modu
which means you can avoid the CDN and host them yourself if you wish. which means you can avoid the CDN and host them yourself if you wish.
enable_muc_push
---------------
* Default: ``false``
If true, then Converse will try to register
`XEP-0357 push notification App Server(s) <https://xmpp.org/extensions/xep-0357.html#general-architecture>`_
for the MUC domain of any newly entered groupchat.
The app servers are specified with the `push_app_servers`_ option.
.. note::
Registering a push app server against a MUC domain is not (yet) standardized
and this feature should be considered experimental.
expose_rid_and_sid expose_rid_and_sid
------------------ ------------------
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
_converse.api.settings.update({ _converse.api.settings.update({
'push_app_servers': [], 'push_app_servers': [],
'enable_muc_push': false
}); });
async function disablePushAppServer (domain, push_app_server) { async function disablePushAppServer (domain, push_app_server) {
...@@ -119,14 +120,16 @@ ...@@ -119,14 +120,16 @@
_converse.session.save('push_enabled', push_enabled); _converse.session.save('push_enabled', push_enabled);
} }
_converse.api.listen.on('statusInitialized', () => enablePush());
function onChatBoxAdded (model) { function onChatBoxAdded (model) {
if (model.get('type') == _converse.CHATROOMS_TYPE) { if (model.get('type') == _converse.CHATROOMS_TYPE) {
enablePush(Strophe.getDomainFromJid(model.get('jid'))); enablePush(Strophe.getDomainFromJid(model.get('jid')));
} }
} }
if (_converse.enable_muc_push) {
_converse.api.listen.on('statusInitialized', () => enablePush());
_converse.api.listen.on('chatBoxesInitialized', () => _converse.chatboxes.on('add', onChatBoxAdded)); _converse.api.listen.on('chatBoxesInitialized', () => _converse.chatboxes.on('add', onChatBoxAdded));
} }
}
}); });
})); }));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment