From 7f371b883e2cf10615b197b13bad4cefb7b4a079 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 3 Oct 2013 14:22:33 +0200 Subject: [PATCH] Add config option ``allow_contact_requests`` to toggle user adding --- CHANGES.rst | 3 +- converse.js | 116 ++++++++++++++++++++++++++++-------------- docs/source/index.rst | 10 ++++ index.html | 1 - 4 files changed, 90 insertions(+), 40 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f11951be2..b6404f1c4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,8 @@ Changelog * Hungarian translation [w3host] * Russian translation [bkocherov] * Update CSS to avoid clash with bootstrap [seocam] -* Add config option ``allow_muc`` to enable/disable multi-user chat (MUC) [jcbrand] +* Add config option ``allow_muc`` to toggle multi-user chat (MUC) [jcbrand] +* Add config option ``allow_contact_requests`` to toggle user adding [jcbrand] 0.6.4 (2013-09-15) ------------------ diff --git a/converse.js b/converse.js index 7e9a9fc28..983fc46bd 100644 --- a/converse.js +++ b/converse.js @@ -41,8 +41,11 @@ }(this, function ($, _, console) { var converse = {}; converse.initialize = function (settings, callback) { - // Default values var converse = this; + // Default values + this.allow_contact_requests = true; + this.allow_muc = true; + this.allow_otr = true; this.animate = true; this.auto_list_rooms = false; this.auto_subscribe = false; @@ -50,17 +53,19 @@ this.debug = false; this.hide_muc_server = false; this.i18n = locales.en; - this.allow_muc = true; this.prebind = false; this.show_controlbox_by_default = false; - this.xhr_user_search = false; - this.xhr_custom_status = false; this.testing = false; // Exposes sensitive data for testing. Never set to true in production systems! + this.xhr_custom_status = false; + this.xhr_user_search = false; + this.callback = callback || function () {}; // Allow only the whitelisted settings attributes to be overwritten, // nothing else. whitelist = [ + 'allow_contact_requests', + 'allow_muc', 'animate', 'auto_list_rooms', 'auto_subscribe', @@ -557,7 +562,7 @@ updateVCard: function () { var jid = this.model.get('jid'), rosteritem = converse.roster.get(jid); - if ((rosteritem)&&(!rosteritem.get('vcard_updated'))) { + if ((rosteritem) && (!rosteritem.get('vcard_updated'))) { converse.getVCard( jid, $.proxy(function (jid, fullname, image, image_type, url) { @@ -565,8 +570,7 @@ 'fullname' : fullname || jid, 'url': url, 'image_type': image_type, - 'image': image, - 'vcard_updated': converse.toISOString(new Date()) + 'image': image }); }, this), $.proxy(function (stanza) { @@ -687,7 +691,10 @@ ''+ ''+ ''+ - ''+ + '' + ), + + add_contact_dropdown_template: _.template( '