mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-07 05:32:19 +03:00
Update openpgpjs library
Small changes
This commit is contained in:
parent
2d9ac0b53a
commit
86f282f885
11 changed files with 263 additions and 183 deletions
|
|
@ -19,8 +19,12 @@ function MessageModel()
|
|||
this.proxy = false;
|
||||
|
||||
this.fromEmailString = ko.observable('');
|
||||
this.fromClearEmailString = ko.observable('');
|
||||
this.toEmailsString = ko.observable('');
|
||||
this.toClearEmailsString = ko.observable('');
|
||||
|
||||
this.senderEmailsString = ko.observable('');
|
||||
this.senderClearEmailsString = ko.observable('');
|
||||
|
||||
this.emails = [];
|
||||
|
||||
|
|
@ -165,10 +169,37 @@ MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
|
|||
return aResult.join(', ');
|
||||
};
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @param {Array} aEmail
|
||||
* @return {string}
|
||||
*/
|
||||
MessageModel.emailsToLineClear = function (aEmail)
|
||||
{
|
||||
var
|
||||
aResult = [],
|
||||
iIndex = 0,
|
||||
iLen = 0
|
||||
;
|
||||
|
||||
if (Utils.isNonEmptyArray(aEmail))
|
||||
{
|
||||
for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
|
||||
{
|
||||
if (aEmail[iIndex] && aEmail[iIndex].email && '' !== aEmail[iIndex].name)
|
||||
{
|
||||
aResult.push(aEmail[iIndex].email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aResult.join(', ');
|
||||
};
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @param {?Array} aJsonEmails
|
||||
* @return {Array}
|
||||
* @return {Array.<EmailModel>}
|
||||
*/
|
||||
MessageModel.initEmailsFromJson = function (aJsonEmails)
|
||||
{
|
||||
|
|
@ -236,8 +267,11 @@ MessageModel.prototype.clear = function ()
|
|||
this.proxy = false;
|
||||
|
||||
this.fromEmailString('');
|
||||
this.fromClearEmailString('');
|
||||
this.toEmailsString('');
|
||||
this.toClearEmailsString('');
|
||||
this.senderEmailsString('');
|
||||
this.senderClearEmailsString('');
|
||||
|
||||
this.emails = [];
|
||||
|
||||
|
|
@ -298,6 +332,9 @@ MessageModel.prototype.computeSenderEmail = function ()
|
|||
|
||||
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
||||
this.toEmailsString() : this.fromEmailString());
|
||||
|
||||
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
||||
this.toClearEmailsString() : this.fromClearEmailString());
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -342,7 +379,9 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
|
|||
this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
|
||||
|
||||
this.fromEmailString(MessageModel.emailsToLine(this.from, true));
|
||||
this.fromClearEmailString(MessageModel.emailsToLineClear(this.from));
|
||||
this.toEmailsString(MessageModel.emailsToLine(this.to, true));
|
||||
this.toClearEmailsString(MessageModel.emailsToLineClear(this.to));
|
||||
|
||||
this.parentUid(Utils.pInt(oJsonMessage.ParentThread));
|
||||
this.threads(Utils.isArray(oJsonMessage.Threads) ? oJsonMessage.Threads : []);
|
||||
|
|
@ -830,7 +869,9 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
|||
this.proxy = oMessage.proxy;
|
||||
|
||||
this.fromEmailString(oMessage.fromEmailString());
|
||||
this.fromClearEmailString(oMessage.fromClearEmailString());
|
||||
this.toEmailsString(oMessage.toEmailsString());
|
||||
this.toClearEmailsString(oMessage.toClearEmailsString());
|
||||
|
||||
this.emails = oMessage.emails;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,12 @@ function PopupsGenerateNewOpenPgpKeyViewModel()
|
|||
this.submitRequest(true);
|
||||
|
||||
_.delay(function () {
|
||||
mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
|
||||
// 0.6.0
|
||||
// mKeyPair = window.openpgp.generateKeyPair({
|
||||
// 'numBits': Utils.pInt(self.keyBitLength()),
|
||||
// 'userId': sUserID,
|
||||
// 'passphrase': Utils.trim(self.password())
|
||||
// });
|
||||
// mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
|
||||
mKeyPair = window.openpgp.generateKeyPair({
|
||||
'userId': sUserID,
|
||||
'numBits': Utils.pInt(self.keyBitLength()),
|
||||
'passphrase': Utils.trim(self.password())
|
||||
});
|
||||
|
||||
if (mKeyPair && mKeyPair.privateKeyArmored)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue