Use the new plugin helper method updateSettings

This commit is contained in:
JC Brand 2016-03-13 16:22:42 +00:00
parent fe47773c7f
commit f55b593791
4 changed files with 13 additions and 24 deletions

View File

@ -10,6 +10,7 @@
define("converse-controlbox", [ define("converse-controlbox", [
"converse-core", "converse-core",
"converse-api", "converse-api",
"converse-rosterview",
// TODO: remove this dependency // TODO: remove this dependency
"converse-chatview" "converse-chatview"
], factory); ], factory);
@ -172,12 +173,9 @@
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
var settings = { this.updateSettings({
show_controlbox_by_default: false, show_controlbox_by_default: false,
}; });
_.extend(converse.default_settings, settings);
_.extend(converse, settings);
_.extend(converse, _.pick(converse.user_settings, Object.keys(settings)));
var STATUSES = { var STATUSES = {
'dnd': __('This contact is busy'), 'dnd': __('This contact is busy'),

View File

@ -28,16 +28,14 @@
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
// Configuration values for this plugin
var settings = { this.updateSettings({
show_desktop_notifications: true, show_desktop_notifications: true,
play_sounds: false, play_sounds: false,
sounds_path: '/sounds/', sounds_path: '/sounds/',
notification_icon: '/logo/conversejs.png' 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) { converse.isOnlyChatStateNotification = function ($msg) {
// See XEP-0085 Chat State Notification // See XEP-0085 Chat State Notification

View File

@ -46,13 +46,10 @@
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
// Configuration values for this plugin
var settings = { this.updateSettings({
ping_interval: 180 //in seconds 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) { converse.ping = function (jid, success, error, timeout) {
// XXX: We could first check here if the server advertised that // XXX: We could first check here if the server advertised that

View File

@ -80,16 +80,12 @@
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
// For translations
// Configuration values for this plugin this.updateSettings({
var settings = {
allow_registration: true, allow_registration: true,
domain_placeholder: __(" e.g. conversejs.org"), // Placeholder text shown in the domain input on the registration form 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 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({ converse.RegisterPanel = Backbone.View.extend({