From 9c6c90a4fc432077b63ac7408f6374841e1eff27 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 31 May 2018 06:38:40 +0200 Subject: [PATCH] Move config settings into the relevant plugins --- docs/source/configuration.rst | 42 ----------------------------------- src/converse-chatboxes.js | 4 +++- src/converse-chatview.js | 3 ++- src/converse-core.js | 10 --------- src/converse-register.js | 7 +++--- src/converse-roster.js | 6 +++++ src/converse-rosterview.js | 2 ++ 7 files changed, 17 insertions(+), 57 deletions(-) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 0b2016d8a..6c83ea3b1 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -711,48 +711,6 @@ Makes sense to set this to ``true`` when also using the non-core ``converse-roomslist`` plugin, which shows a list of currently open (i.e. "joined") rooms. -include_offline_state ---------------------- - -* Default: `false` - -Originally, converse.js included an `offline` state which the user could -choose (along with `online`, `busy` and `away`). - -Eventually it was however decided to remove this state, since the `offline` -state doesn't propagate across tabs like the others do. - -What's meant by "propagate across tabs", is that when you set the state to -`offline` in one tab, and you have instances of converse.js open in other tabs -in your browser, then those instances will not have their states changed to -`offline` as well. For the other statees the change is however propagated. - -The reason for this is that according to the XMPP spec, there is no `offline` -state. The only defined states are: - -* away -- The entity or resource is temporarily away. -* chat -- The entity or resource is actively interested in chattiIng. -* dnd -- The entity or resource is busy (dnd = "Do Not Disturb"). -* xa -- The entity or resource is away for an extended period (xa = "eXtended Away"). - -Read the `relevant section in the XMPP spec `_ -for more info. - -What used to happen in converse.js when the `offline` state was chosen, is -that a presence stanza with a `type` of `unavailable` was sent out. - -This is actually exactly what happens when you log out of converse.js as well, -with the notable exception that in the `offline` state, the connection is not -terminated. So you can at any time change your state to something else and -start chatting again. - -This might be useful to people, however the fact that the `offline` state -doesn't propagate across tabs means that the user experience is inconsistent, -confusing and appears "broken". - -If you are however aware of this issue and still want to allow the `offline` -state, then you can set this option to `true` to enable it. - .. _`i18n`: i18n diff --git a/src/converse-chatboxes.js b/src/converse-chatboxes.js index 6ac033f7c..4025213fd 100644 --- a/src/converse-chatboxes.js +++ b/src/converse-chatboxes.js @@ -62,7 +62,9 @@ // Refer to docs/source/configuration.rst for explanations of these // configuration settings. _converse.api.settings.update({ - auto_join_private_chats: [], + 'filter_by_resource': false, + 'auto_join_private_chats': [], + 'forward_messages': false, }); _converse.api.promises.add([ 'chatBoxesFetched', diff --git a/src/converse-chatview.js b/src/converse-chatview.js index bf8a9e42e..964126eaf 100644 --- a/src/converse-chatview.js +++ b/src/converse-chatview.js @@ -101,10 +101,11 @@ { __ } = _converse; _converse.api.settings.update({ - 'use_emojione': false, 'emojione_image_path': emojione.imagePathPNG, + 'show_send_button': false, 'show_toolbar': true, 'time_format': 'HH:mm', + 'use_emojione': false, 'visible_toolbar_buttons': { 'call': false, 'clear': true, diff --git a/src/converse-core.js b/src/converse-core.js index 0a15e41c6..38062948b 100644 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -293,14 +293,12 @@ // Default configuration values // ---------------------------- this.default_settings = { - allow_contact_requests: true, allow_non_roster_messaging: false, animate: true, authentication: 'login', // Available values are "login", "prebind", "anonymous" and "external". auto_away: 0, // Seconds after which user status is set to 'away' auto_login: false, // Currently only used in connection with anonymous login auto_reconnect: true, - auto_subscribe: false, auto_xa: 0, // Seconds after which user status is set to 'xa' blacklisted_plugins: [], bosh_service_url: undefined, @@ -310,12 +308,8 @@ debug: false, default_state: 'online', expose_rid_and_sid: false, - filter_by_resource: false, - forward_messages: false, geouri_regex: /https:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g, geouri_replacement: 'https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2', - hide_offline_users: false, - include_offline_state: false, jid: undefined, keepalive: true, locales_url: 'locale/{{{locale}}}/LC_MESSAGES/converse.json', @@ -329,15 +323,11 @@ password: undefined, prebind_url: null, priority: 0, - registration_domain: '', rid: undefined, root: window.document, - show_only_online_users: false, - show_send_button: false, sid: undefined, storage: 'session', strict_plugin_dependencies: false, - synchronize_availability: true, trusted: true, view_mode: 'overlayed', // Choices are 'overlayed', 'fullscreen', 'mobile' websocket_url: undefined, diff --git a/src/converse-register.js b/src/converse-register.js index 7821c0288..e80f7cb3a 100644 --- a/src/converse-register.js +++ b/src/converse-register.js @@ -144,9 +144,10 @@ _converse.CONNECTION_STATUS[Strophe.Status.NOTACCEPTABLE] = 'NOTACCEPTABLE'; _converse.api.settings.update({ - allow_registration: true, - domain_placeholder: __(" e.g. conversejs.org"), // Placeholder text shown in the domain input on the registration form - providers_link: 'https://xmpp.net/directory.php', // Link to XMPP providers shown on registration page + 'allow_registration': true, + 'domain_placeholder': __(" e.g. conversejs.org"), // Placeholder text shown in the domain input on the registration form + 'providers_link': 'https://xmpp.net/directory.php', // Link to XMPP providers shown on registration page + 'registration_domain': '' }); diff --git a/src/converse-roster.js b/src/converse-roster.js index fdfb50387..f0e42c800 100644 --- a/src/converse-roster.js +++ b/src/converse-roster.js @@ -22,6 +22,12 @@ const { _converse } = this, { __ } = _converse; + _converse.api.settings.update({ + 'allow_contact_requests': true, + 'auto_subscribe': false, + 'synchronize_availability': true, + }); + _converse.api.promises.add([ 'cachedRoster', 'roster', diff --git a/src/converse-rosterview.js b/src/converse-rosterview.js index 31d9eb5af..78d7e0d18 100644 --- a/src/converse-rosterview.js +++ b/src/converse-rosterview.js @@ -80,7 +80,9 @@ _converse.api.settings.update({ 'allow_chat_pending_contacts': true, 'allow_contact_removal': true, + 'hide_offline_users': false, 'roster_groups': true, + 'show_only_online_users': false, 'show_toolbar': true, 'xhr_user_search_url': null });