From f55b5937915990e695446d3b6b5e5dbb3017700a Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sun, 13 Mar 2016 16:22:42 +0000 Subject: [PATCH] Use the new plugin helper method updateSettings --- src/converse-controlbox.js | 8 +++----- src/converse-notification.js | 10 ++++------ src/converse-ping.js | 9 +++------ src/converse-register.js | 10 +++------- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/converse-controlbox.js b/src/converse-controlbox.js index 66abbfa55..4b93a5b0e 100644 --- a/src/converse-controlbox.js +++ b/src/converse-controlbox.js @@ -10,6 +10,7 @@ define("converse-controlbox", [ "converse-core", "converse-api", + "converse-rosterview", // TODO: remove this dependency "converse-chatview" ], factory); @@ -172,12 +173,9 @@ * loaded by converse.js's plugin machinery. */ var converse = this.converse; - var settings = { + this.updateSettings({ show_controlbox_by_default: false, - }; - _.extend(converse.default_settings, settings); - _.extend(converse, settings); - _.extend(converse, _.pick(converse.user_settings, Object.keys(settings))); + }); var STATUSES = { 'dnd': __('This contact is busy'), diff --git a/src/converse-notification.js b/src/converse-notification.js index 5e6bccfa3..6907f64dd 100644 --- a/src/converse-notification.js +++ b/src/converse-notification.js @@ -28,16 +28,14 @@ * loaded by converse.js's plugin machinery. */ var converse = this.converse; - // Configuration values for this plugin - var settings = { + + this.updateSettings({ show_desktop_notifications: true, play_sounds: false, sounds_path: '/sounds/', notification_icon: '/logo/conversejs.png' - }; - _.extend(converse.default_settings, settings); - _.extend(converse, settings); - _.extend(converse, _.pick(converse.user_settings, Object.keys(settings))); + }); + converse.isOnlyChatStateNotification = function ($msg) { // See XEP-0085 Chat State Notification diff --git a/src/converse-ping.js b/src/converse-ping.js index e67c1f017..2fcbc7d72 100644 --- a/src/converse-ping.js +++ b/src/converse-ping.js @@ -46,13 +46,10 @@ * loaded by converse.js's plugin machinery. */ var converse = this.converse; - // Configuration values for this plugin - var settings = { + + this.updateSettings({ ping_interval: 180 //in seconds - }; - _.extend(converse.default_settings, settings); - _.extend(converse, settings); - _.extend(converse, _.pick(converse.user_settings, Object.keys(settings))); + }); converse.ping = function (jid, success, error, timeout) { // XXX: We could first check here if the server advertised that diff --git a/src/converse-register.js b/src/converse-register.js index eabd31edd..4da1e545a 100644 --- a/src/converse-register.js +++ b/src/converse-register.js @@ -80,16 +80,12 @@ * loaded by converse.js's plugin machinery. */ var converse = this.converse; - // For translations - // Configuration values for this plugin - var settings = { + + this.updateSettings({ 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 - }; - _.extend(converse.default_settings, settings); - _.extend(converse, settings); - _.extend(converse, _.pick(converse.user_settings, Object.keys(settings))); + }); converse.RegisterPanel = Backbone.View.extend({