Commit fd918a52 authored by Pete Nicholls's avatar Pete Nicholls

Support using OTR by default

parent e3e8bf6c
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
this.xhr_custom_status_url = ''; this.xhr_custom_status_url = '';
this.xhr_user_search = false; this.xhr_user_search = false;
this.xhr_user_search_url = ''; this.xhr_user_search_url = '';
this.use_otr_by_default = false;
// Allow only whitelisted configuration attributes to be overwritten // Allow only whitelisted configuration attributes to be overwritten
_.extend(this, _.pick(settings, [ _.extend(this, _.pick(settings, [
...@@ -171,12 +172,16 @@ ...@@ -171,12 +172,16 @@
'xhr_custom_status', 'xhr_custom_status',
'xhr_custom_status_url', 'xhr_custom_status_url',
'xhr_user_search', 'xhr_user_search',
'xhr_user_search_url' 'xhr_user_search_url',
'use_otr_by_default'
])); ]));
// Only allow OTR if we have the capability // Only allow OTR if we have the capability
this.allow_otr = this.allow_otr && HAS_CRYPTO; 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 // Translation machinery
// --------------------- // ---------------------
var __ = $.proxy(function (str) { var __ = $.proxy(function (str) {
...@@ -836,9 +841,14 @@ ...@@ -836,9 +841,14 @@
this.updateVCard(); this.updateVCard();
this.$el.appendTo(converse.chatboxesview.$el); this.$el.appendTo(converse.chatboxesview.$el);
this.render().show().model.messages.fetch({add: true}); this.render().show().model.messages.fetch({add: true});
if (this.model.get('status')) { if (this.model.get('status')) {
this.showStatusMessage(this.model.get('status')); this.showStatusMessage(this.model.get('status'));
} }
if (converse.use_otr_by_default) {
this.model.initiateOTR();
}
}, },
render: function () { render: function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment