Commit 39b3aa34 authored by JC Brand's avatar JC Brand

Fixes #848 OTR doesn't start when `cache_otr_key` is set to `true`

parent 15f6649a
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
- Bugfix: OTR meta-messages were being shown in HTML5 notifications. [jcbrand] - Bugfix: OTR meta-messages were being shown in HTML5 notifications. [jcbrand]
- CSS fix: Icon lock wasn't showing. [jcbrand] - CSS fix: Icon lock wasn't showing. [jcbrand]
- #842 Persistent muc room creation not working [jcbrand] - #842 Persistent muc room creation not working [jcbrand]
- #848 OTR doesn't start when `cache_otr_key` is set to `true`. [jcbrand]
- #849 `TypeError: _converse.i18n.locale_data is undefined` when reconnecting. [jcbrand] - #849 `TypeError: _converse.i18n.locale_data is undefined` when reconnecting. [jcbrand]
## 3.0.1 (2017-04-04) ## 3.0.1 (2017-04-04)
......
...@@ -129,17 +129,20 @@ ...@@ -129,17 +129,20 @@
getSession: function (callback) { getSession: function (callback) {
var _converse = this.__super__._converse, var _converse = this.__super__._converse,
__ = _converse.__; __ = _converse.__;
var instance_tag, saved_key; var instance_tag, saved_key, encrypted_key;
if (_converse.cache_otr_key) { if (_converse.cache_otr_key) {
instance_tag = this.get('otr_instance_tag'); encrypted_key = this.get('otr_priv_key');
saved_key = otr.DSA.parsePrivate(this.get('otr_priv_key')); if (_.isString(encrypted_key)) {
if (saved_key && instance_tag) { instance_tag = this.get('otr_instance_tag');
this.trigger('showHelpMessages', [__('Re-establishing encrypted session')]); saved_key = otr.DSA.parsePrivate(encrypted_key)
callback({ if (saved_key && instance_tag) {
'key': saved_key, this.trigger('showHelpMessages', [__('Re-establishing encrypted session')]);
'instance_tag': instance_tag callback({
}); 'key': saved_key,
return; // Our work is done here 'instance_tag': instance_tag
});
return; // Our work is done here
}
} }
} }
// We need to generate a new key and instance tag // We need to generate a new key and instance tag
...@@ -151,10 +154,9 @@ ...@@ -151,10 +154,9 @@
); );
var that = this; var that = this;
window.setTimeout(function () { window.setTimeout(function () {
var instance_tag = otr.OTR.makeInstanceTag();
callback({ callback({
'key': that.generatePrivateKey(instance_tag), 'key': that.generatePrivateKey(instance_tag),
'instance_tag': instance_tag 'instance_tag': otr.OTR.makeInstanceTag()
}); });
}, 500); }, 500);
}, },
......
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