From fd918a52437d2548818e8ec8bfab55b243d7a960 Mon Sep 17 00:00:00 2001 From: Pete Nicholls Date: Tue, 10 Dec 2013 23:28:22 +1300 Subject: [PATCH 1/2] Support using OTR by default --- converse.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/converse.js b/converse.js index fceac4529..a4b75693d 100644 --- a/converse.js +++ b/converse.js @@ -144,6 +144,7 @@ this.xhr_custom_status_url = ''; this.xhr_user_search = false; this.xhr_user_search_url = ''; + this.use_otr_by_default = false; // Allow only whitelisted configuration attributes to be overwritten _.extend(this, _.pick(settings, [ @@ -171,12 +172,16 @@ 'xhr_custom_status', 'xhr_custom_status_url', 'xhr_user_search', - 'xhr_user_search_url' + 'xhr_user_search_url', + 'use_otr_by_default' ])); // Only allow OTR if we have the capability this.allow_otr = this.allow_otr && HAS_CRYPTO; + // Only use OTR by default if allow OTR is enabled to begin with + this.use_otr_by_default = this.use_otr_by_default && this.allow_otr; + // Translation machinery // --------------------- var __ = $.proxy(function (str) { @@ -836,9 +841,14 @@ this.updateVCard(); this.$el.appendTo(converse.chatboxesview.$el); this.render().show().model.messages.fetch({add: true}); + if (this.model.get('status')) { this.showStatusMessage(this.model.get('status')); } + + if (converse.use_otr_by_default) { + this.model.initiateOTR(); + } }, render: function () { From 201004f815b94099a5becd73c46c48e857198158 Mon Sep 17 00:00:00 2001 From: Pete Nicholls Date: Thu, 19 Dec 2013 12:01:06 +1300 Subject: [PATCH 2/2] Order options alphabetically --- converse.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/converse.js b/converse.js index a4b75693d..24539f396 100644 --- a/converse.js +++ b/converse.js @@ -139,12 +139,12 @@ this.show_only_online_users = false; this.show_emoticons = true; this.show_toolbar = true; + this.use_otr_by_default = false; this.use_vcards = true; this.xhr_custom_status = false; this.xhr_custom_status_url = ''; this.xhr_user_search = false; this.xhr_user_search_url = ''; - this.use_otr_by_default = false; // Allow only whitelisted configuration attributes to be overwritten _.extend(this, _.pick(settings, [ @@ -168,12 +168,12 @@ 'show_only_online_users', 'show_toolbar', 'sid', + 'use_otr_by_default', 'use_vcards', 'xhr_custom_status', 'xhr_custom_status_url', 'xhr_user_search', - 'xhr_user_search_url', - 'use_otr_by_default' + 'xhr_user_search_url' ])); // Only allow OTR if we have the capability