OpenPGP (Compose) (#53) UNSTABLE

This commit is contained in:
RainLoop Team 2014-03-21 03:47:13 +04:00
parent b330f77bc0
commit 1c4ce1dfb2
14 changed files with 631 additions and 321 deletions

View file

@ -328,6 +328,7 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{ {
var var
aKeys = [], aKeys = [],
oEmail = new EmailModel(),
oOpenpgpKeyring = RL.data().openpgpKeyring, oOpenpgpKeyring = RL.data().openpgpKeyring,
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : [] oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : []
; ;
@ -336,20 +337,28 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
if (oItem && oItem.primaryKey) if (oItem && oItem.primaryKey)
{ {
var var
oPrimaryUser = oItem.getPrimaryUser(), oPrimaryUser = oItem.getPrimaryUser(),
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid
: (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '') : (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '')
; ;
oEmail.clear();
oEmail.mailsoParse(sUser);
if (oEmail.validate())
{
aKeys.push(new OpenPgpKeyModel( aKeys.push(new OpenPgpKeyModel(
iIndex, iIndex,
oItem.primaryKey.getFingerprint(), oItem.primaryKey.getFingerprint(),
oItem.primaryKey.getKeyId().toHex().toLowerCase(), oItem.primaryKey.getKeyId().toHex().toLowerCase(),
sUser, sUser,
oEmail.email,
oItem.isPrivate(), oItem.isPrivate(),
oItem.armor()) oItem.armor())
); );
} }
}
}); });
RL.data().openpgpkeys(aKeys); RL.data().openpgpkeys(aKeys);

View file

@ -182,6 +182,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65/* A */, 'selectAll'); self.editor.setKeystroke(window.CKEDITOR.CTRL + 65/* A */, 'selectAll');
self.fOnReady(); self.fOnReady();
self.__resizable = true;
self.resize(); self.resize();
}); });
} }
@ -206,7 +207,7 @@ NewHtmlEditorWrapper.prototype.blur = function ()
NewHtmlEditorWrapper.prototype.resize = function () NewHtmlEditorWrapper.prototype.resize = function ()
{ {
if (this.editor) if (this.editor && this.__resizable)
{ {
this.editor.resize(this.$element.width(), this.$element.innerHeight()); this.editor.resize(this.$element.width(), this.$element.innerHeight());
} }

View file

@ -5,16 +5,18 @@
* @param {string} sGuID * @param {string} sGuID
* @param {string} sID * @param {string} sID
* @param {string} sUserID * @param {string} sUserID
* @param {string} sEmail
* @param {boolean} bIsPrivate * @param {boolean} bIsPrivate
* @param {string} sArmor * @param {string} sArmor
* @constructor * @constructor
*/ */
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, bIsPrivate, sArmor) function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
{ {
this.index = iIndex; this.index = iIndex;
this.id = sID; this.id = sID;
this.guid = sGuID; this.guid = sGuID;
this.user = sUserID; this.user = sUserID;
this.email = sEmail;
this.armor = sArmor; this.armor = sArmor;
this.isPrivate = !!bIsPrivate; this.isPrivate = !!bIsPrivate;
@ -25,5 +27,6 @@ OpenPgpKeyModel.prototype.index = 0;
OpenPgpKeyModel.prototype.id = ''; OpenPgpKeyModel.prototype.id = '';
OpenPgpKeyModel.prototype.guid = ''; OpenPgpKeyModel.prototype.guid = '';
OpenPgpKeyModel.prototype.user = ''; OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.email = '';
OpenPgpKeyModel.prototype.armor = ''; OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false; OpenPgpKeyModel.prototype.isPrivate = false;

View file

@ -6,18 +6,8 @@
function SettingsOpenPGP() function SettingsOpenPGP()
{ {
this.openpgpkeys = RL.data().openpgpkeys; this.openpgpkeys = RL.data().openpgpkeys;
this.openpgpkeysPublic = RL.data().openpgpkeysPublic;
this.openpgpkeysPublic = ko.computed(function () { this.openpgpkeysPrivate = RL.data().openpgpkeysPrivate;
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && !oItem.isPrivate);
});
}, this);
this.openpgpkeysPrivate = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && oItem.isPrivate);
});
}, this);
this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this, this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
function (oPrev) { function (oPrev) {

View file

@ -98,7 +98,6 @@ function WebMailDataStorage()
return bLoading || bCreating || bDeleting || bRenaming; return bLoading || bCreating || bDeleting || bRenaming;
}, this); }, this);
this.foldersInboxUnreadCount = ko.observable(0); this.foldersInboxUnreadCount = ko.observable(0);
this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null, this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,
@ -348,6 +347,18 @@ function WebMailDataStorage()
this.openpgpkeys = ko.observableArray([]); this.openpgpkeys = ko.observableArray([]);
this.openpgpKeyring = null; this.openpgpKeyring = null;
this.openpgpkeysPublic = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && !oItem.isPrivate);
});
}, this);
this.openpgpkeysPrivate = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && oItem.isPrivate);
});
}, this);
// google // google
this.googleActions = ko.observable(false); this.googleActions = ko.observable(false);
this.googleLoggined = ko.observable(false); this.googleLoggined = ko.observable(false);
@ -716,7 +727,6 @@ WebMailDataStorage.prototype.getNextFolderNames = function (bBoot)
}; };
/** /**
* @param {Function} fCallback
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string=} sToFolderFullNameRaw = '' * @param {string=} sToFolderFullNameRaw = ''

View file

@ -16,13 +16,168 @@ function PopupsComposeOpenPgpViewModel()
this.password = ko.observable(''); this.password = ko.observable('');
this.password.focus = ko.observable(true); this.password.focus = ko.observable(true);
this.from = ko.observable('');
this.to = ko.observableArray([]);
this.text = ko.observable('');
this.resultCallback = null;
this.submitRequest = ko.observable(false);
// commands // commands
this.doCommand = Utils.createCommand(this, function () { this.doCommand = Utils.createCommand(this, function () {
this.cancelCommand(); var
self = this,
bResult = true,
aOpenpgpkeysPublic = RL.data().openpgpkeysPublic(),
oKey = null,
oPrivateKey = null,
aPublicKeys = [],
fFindPublicKey = function (sEmail) {
var
oResult = null,
oKey = _.find(aOpenpgpkeysPublic, function (oItem) {
return oItem && sEmail === oItem.email;
})
;
if (oKey)
{
try
{
oResult = window.openpgp.key.readArmored(oKey.armor);
if (oResult && !oResult.err && oResult.keys && oResult.keys[0])
{
oResult = oResult.keys[0];
}
else
{
oResult = null;
}
}
catch (e)
{
oResult = null;
}
}
return oResult;
}
;
this.submitRequest(true);
if (bResult && this.sign() && '' === this.from())
{
this.notification('Please specify From email address');
bResult = false;
}
if (bResult && this.sign())
{
oKey = _.find(RL.data().openpgpkeysPrivate(), function (oItem) {
return oItem && self.from() === oItem.email;
});
if (oKey)
{
try
{
oPrivateKey = window.openpgp.key.readArmored(oKey.armor);
if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
{
oPrivateKey = oPrivateKey.keys[0];
oPrivateKey.decrypt(this.password());
}
else
{
oPrivateKey = null;
}
}
catch (e)
{
oPrivateKey = null;
}
}
if (!oPrivateKey)
{
this.notification('No private key found for "' + this.from() + '" email');
bResult = false;
}
}
if (bResult && this.encrypt() && 0 === this.to().length)
{
this.notification('Please specify at least one recipient');
bResult = false;
}
if (bResult && this.encrypt())
{
aPublicKeys = _.compact(_.map(this.to(), function (sEmail) {
var oKey = fFindPublicKey(sEmail);
if (!oKey && bResult)
{
self.notification('No public key found for "' + sEmail + '" email');
bResult = false;
}
return oKey;
}));
if (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length)
{
bResult = false;
}
}
_.delay(function () {
if (self.resultCallback && bResult)
{
try {
if (oPrivateKey && 0 === aPublicKeys.length)
{
self.resultCallback(
window.openpgp.signClearMessage([oPrivateKey], self.text())
);
}
else if (oPrivateKey && 0 < aPublicKeys.length)
{
self.resultCallback(
window.openpgp.signAndEncryptMessage(aPublicKeys, oPrivateKey, self.text())
);
}
else if (!oPrivateKey && 0 < aPublicKeys.length)
{
self.resultCallback(
window.openpgp.encryptMessage(aPublicKeys, self.text())
);
}
}
catch (e)
{
self.notification('OpenPGP error: ' + e);
bResult = false;
}
}
if (bResult)
{
self.cancelCommand();
}
self.submitRequest(false);
}, 10);
}, function () { }, function () {
return '' === this.notification(); return !this.submitRequest() && (this.sign() || this.encrypt());
}); });
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
@ -36,6 +191,14 @@ PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
this.password(''); this.password('');
this.password.focus(false); this.password.focus(false);
this.from('');
this.to([]);
this.text('');
this.submitRequest(false);
this.resultCallback = null;
}; };
PopupsComposeOpenPgpViewModel.prototype.onHide = function () PopupsComposeOpenPgpViewModel.prototype.onHide = function ()
@ -53,20 +216,11 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr
aRec = [] aRec = []
; ;
if ('' === sTo + sCc + sBcc) this.resultCallback = fCallback;
{
this.notification('Please specify at least one recipient');
return false;
}
oEmail.clear(); oEmail.clear();
oEmail.mailsoParse(sFromEmail); oEmail.mailsoParse(sFromEmail);
if ('' === oEmail.email) if ('' !== oEmail.email)
{
this.notification('Please specify From email address');
return false;
}
else
{ {
sResultFromEmail = oEmail.email; sResultFromEmail = oEmail.email;
} }
@ -93,22 +247,7 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr
return '' === oEmail.email ? false : oEmail.email; return '' === oEmail.email ? false : oEmail.email;
})); }));
if (0 === aRec.length) this.from(sResultFromEmail);
{ this.to(aRec);
this.notification('Please specify at least one recipient'); this.text(sText);
return false;
}
window.console.log(sResultFromEmail);
window.console.log(aRec);
// TODO
};
PopupsComposeOpenPgpViewModel.prototype.onFocus = function ()
{
if (this.sign())
{
this.password.focus(true);
}
}; };

View file

@ -362,9 +362,12 @@ PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
{ {
if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml()) if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml())
{ {
var self = this;
kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [ kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [
function () { function (sResult) {
self.editor(function (oEditor) {
oEditor.setPlain(sResult);
});
}, },
this.oEditor.getData(), this.oEditor.getData(),
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),

View file

@ -36,7 +36,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn buttonDo" data-bind="command: doCommand"> <a class="btn buttonDo" data-bind="command: doCommand">
<i class="icon-key"></i> <i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/BUTTON_DO"></span> <span class="i18n" data-i18n-text="POPUPS_COMPOSE_OPEN_PGP/BUTTON_DO"></span>
</a> </a>

File diff suppressed because one or more lines are too long

View file

@ -3826,6 +3826,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65/* A */, 'selectAll'); self.editor.setKeystroke(window.CKEDITOR.CTRL + 65/* A */, 'selectAll');
self.fOnReady(); self.fOnReady();
self.__resizable = true;
self.resize(); self.resize();
}); });
} }
@ -3850,7 +3851,7 @@ NewHtmlEditorWrapper.prototype.blur = function ()
NewHtmlEditorWrapper.prototype.resize = function () NewHtmlEditorWrapper.prototype.resize = function ()
{ {
if (this.editor) if (this.editor && this.__resizable)
{ {
this.editor.resize(this.$element.width(), this.$element.innerHeight()); this.editor.resize(this.$element.width(), this.$element.innerHeight());
} }
@ -7383,16 +7384,18 @@ IdentityModel.prototype.formattedNameForEmail = function ()
* @param {string} sGuID * @param {string} sGuID
* @param {string} sID * @param {string} sID
* @param {string} sUserID * @param {string} sUserID
* @param {string} sEmail
* @param {boolean} bIsPrivate * @param {boolean} bIsPrivate
* @param {string} sArmor * @param {string} sArmor
* @constructor * @constructor
*/ */
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, bIsPrivate, sArmor) function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
{ {
this.index = iIndex; this.index = iIndex;
this.id = sID; this.id = sID;
this.guid = sGuID; this.guid = sGuID;
this.user = sUserID; this.user = sUserID;
this.email = sEmail;
this.armor = sArmor; this.armor = sArmor;
this.isPrivate = !!bIsPrivate; this.isPrivate = !!bIsPrivate;
@ -7403,6 +7406,7 @@ OpenPgpKeyModel.prototype.index = 0;
OpenPgpKeyModel.prototype.id = ''; OpenPgpKeyModel.prototype.id = '';
OpenPgpKeyModel.prototype.guid = ''; OpenPgpKeyModel.prototype.guid = '';
OpenPgpKeyModel.prototype.user = ''; OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.email = '';
OpenPgpKeyModel.prototype.armor = ''; OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false; OpenPgpKeyModel.prototype.isPrivate = false;
@ -8079,9 +8083,12 @@ PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
{ {
if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml()) if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml())
{ {
var self = this;
kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [ kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [
function () { function (sResult) {
self.editor(function (oEditor) {
oEditor.setPlain(sResult);
});
}, },
this.oEditor.getData(), this.oEditor.getData(),
this.currentIdentityResultEmail(), this.currentIdentityResultEmail(),
@ -10274,13 +10281,168 @@ function PopupsComposeOpenPgpViewModel()
this.password = ko.observable(''); this.password = ko.observable('');
this.password.focus = ko.observable(true); this.password.focus = ko.observable(true);
this.from = ko.observable('');
this.to = ko.observableArray([]);
this.text = ko.observable('');
this.resultCallback = null;
this.submitRequest = ko.observable(false);
// commands // commands
this.doCommand = Utils.createCommand(this, function () { this.doCommand = Utils.createCommand(this, function () {
this.cancelCommand(); var
self = this,
bResult = true,
aOpenpgpkeysPublic = RL.data().openpgpkeysPublic(),
oKey = null,
oPrivateKey = null,
aPublicKeys = [],
fFindPublicKey = function (sEmail) {
var
oResult = null,
oKey = _.find(aOpenpgpkeysPublic, function (oItem) {
return oItem && sEmail === oItem.email;
})
;
if (oKey)
{
try
{
oResult = window.openpgp.key.readArmored(oKey.armor);
if (oResult && !oResult.err && oResult.keys && oResult.keys[0])
{
oResult = oResult.keys[0];
}
else
{
oResult = null;
}
}
catch (e)
{
oResult = null;
}
}
return oResult;
}
;
this.submitRequest(true);
if (bResult && this.sign() && '' === this.from())
{
this.notification('Please specify From email address');
bResult = false;
}
if (bResult && this.sign())
{
oKey = _.find(RL.data().openpgpkeysPrivate(), function (oItem) {
return oItem && self.from() === oItem.email;
});
if (oKey)
{
try
{
oPrivateKey = window.openpgp.key.readArmored(oKey.armor);
if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
{
oPrivateKey = oPrivateKey.keys[0];
oPrivateKey.decrypt(this.password());
}
else
{
oPrivateKey = null;
}
}
catch (e)
{
oPrivateKey = null;
}
}
if (!oPrivateKey)
{
this.notification('No private key found for "' + this.from() + '" email!');
bResult = false;
}
}
if (bResult && this.encrypt() && 0 === this.to().length)
{
this.notification('Please specify at least one recipient');
bResult = false;
}
if (bResult && this.encrypt())
{
aPublicKeys = _.compact(_.map(this.to(), function (sEmail) {
var oKey = fFindPublicKey(sEmail);
if (!oKey && bResult)
{
self.notification('No public key found for "' + sEmail + '" email!');
bResult = false;
}
return oKey;
}));
if (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length)
{
bResult = false;
}
}
_.delay(function () {
if (self.resultCallback && bResult)
{
try {
if (oPrivateKey && 0 === aPublicKeys.length)
{
self.resultCallback(
window.openpgp.signClearMessage([oPrivateKey], self.text())
);
}
else if (oPrivateKey && 0 < aPublicKeys.length)
{
self.resultCallback(
window.openpgp.signAndEncryptMessage(aPublicKeys, oPrivateKey, self.text())
);
}
else if (!oPrivateKey && 0 < aPublicKeys.length)
{
self.resultCallback(
window.openpgp.encryptMessage(aPublicKeys, self.text())
);
}
}
catch (e)
{
self.notification('OpenPGP error: ' + e);
bResult = false;
}
}
if (bResult)
{
self.cancelCommand();
}
self.submitRequest(false);
}, 10);
}, function () { }, function () {
return '' === this.notification(); return !this.submitRequest() && (this.sign() || this.encrypt());
}); });
Knoin.constructorEnd(this); Knoin.constructorEnd(this);
@ -10294,6 +10456,14 @@ PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
this.password(''); this.password('');
this.password.focus(false); this.password.focus(false);
this.from('');
this.to([]);
this.text('');
this.submitRequest(false);
this.resultCallback = null;
}; };
PopupsComposeOpenPgpViewModel.prototype.onHide = function () PopupsComposeOpenPgpViewModel.prototype.onHide = function ()
@ -10311,20 +10481,11 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr
aRec = [] aRec = []
; ;
if ('' === sTo + sCc + sBcc) this.resultCallback = fCallback;
{
this.notification('Please specify at least one recipient');
return false;
}
oEmail.clear(); oEmail.clear();
oEmail.mailsoParse(sFromEmail); oEmail.mailsoParse(sFromEmail);
if ('' === oEmail.email) if ('' !== oEmail.email)
{
this.notification('Please specify From email address');
return false;
}
else
{ {
sResultFromEmail = oEmail.email; sResultFromEmail = oEmail.email;
} }
@ -10351,24 +10512,9 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr
return '' === oEmail.email ? false : oEmail.email; return '' === oEmail.email ? false : oEmail.email;
})); }));
if (0 === aRec.length) this.from(sResultFromEmail);
{ this.to(aRec);
this.notification('Please specify at least one recipient'); this.text(sText);
return false;
}
window.console.log(sResultFromEmail);
window.console.log(aRec);
// TODO
};
PopupsComposeOpenPgpViewModel.prototype.onFocus = function ()
{
if (this.sign())
{
this.password.focus(true);
}
}; };
/** /**
@ -12918,18 +13064,8 @@ Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LAB
function SettingsOpenPGP() function SettingsOpenPGP()
{ {
this.openpgpkeys = RL.data().openpgpkeys; this.openpgpkeys = RL.data().openpgpkeys;
this.openpgpkeysPublic = RL.data().openpgpkeysPublic;
this.openpgpkeysPublic = ko.computed(function () { this.openpgpkeysPrivate = RL.data().openpgpkeysPrivate;
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && !oItem.isPrivate);
});
}, this);
this.openpgpkeysPrivate = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && oItem.isPrivate);
});
}, this);
this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this, this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
function (oPrev) { function (oPrev) {
@ -13664,7 +13800,6 @@ function WebMailDataStorage()
return bLoading || bCreating || bDeleting || bRenaming; return bLoading || bCreating || bDeleting || bRenaming;
}, this); }, this);
this.foldersInboxUnreadCount = ko.observable(0); this.foldersInboxUnreadCount = ko.observable(0);
this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null, this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,
@ -13914,6 +14049,18 @@ function WebMailDataStorage()
this.openpgpkeys = ko.observableArray([]); this.openpgpkeys = ko.observableArray([]);
this.openpgpKeyring = null; this.openpgpKeyring = null;
this.openpgpkeysPublic = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && !oItem.isPrivate);
});
}, this);
this.openpgpkeysPrivate = ko.computed(function () {
return _.filter(this.openpgpkeys(), function (oItem) {
return !!(oItem && oItem.isPrivate);
});
}, this);
// google // google
this.googleActions = ko.observable(false); this.googleActions = ko.observable(false);
this.googleLoggined = ko.observable(false); this.googleLoggined = ko.observable(false);
@ -14282,7 +14429,6 @@ WebMailDataStorage.prototype.getNextFolderNames = function (bBoot)
}; };
/** /**
* @param {Function} fCallback
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string=} sToFolderFullNameRaw = '' * @param {string=} sToFolderFullNameRaw = ''
@ -17113,6 +17259,7 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{ {
var var
aKeys = [], aKeys = [],
oEmail = new EmailModel(),
oOpenpgpKeyring = RL.data().openpgpKeyring, oOpenpgpKeyring = RL.data().openpgpKeyring,
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : [] oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.keys : []
; ;
@ -17121,20 +17268,28 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
if (oItem && oItem.primaryKey) if (oItem && oItem.primaryKey)
{ {
var var
oPrimaryUser = oItem.getPrimaryUser(), oPrimaryUser = oItem.getPrimaryUser(),
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid
: (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '') : (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '')
; ;
oEmail.clear();
oEmail.mailsoParse(sUser);
if (oEmail.validate())
{
aKeys.push(new OpenPgpKeyModel( aKeys.push(new OpenPgpKeyModel(
iIndex, iIndex,
oItem.primaryKey.getFingerprint(), oItem.primaryKey.getFingerprint(),
oItem.primaryKey.getKeyId().toHex().toLowerCase(), oItem.primaryKey.getKeyId().toHex().toLowerCase(),
sUser, sUser,
oEmail.email,
oItem.isPrivate(), oItem.isPrivate(),
oItem.armor()) oItem.armor())
); );
} }
}
}); });
RL.data().openpgpkeys(aKeys); RL.data().openpgpkeys(aKeys);

File diff suppressed because one or more lines are too long