mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 19:02:20 -05:00
refactor displaylist var
This commit is contained in:
parent
785ba0c9e8
commit
ab5e5a573d
@ -303,7 +303,7 @@ define(function(require) {
|
|||||||
*/
|
*/
|
||||||
EmailDAO.prototype.listMessages = function(options, callback) {
|
EmailDAO.prototype.listMessages = function(options, callback) {
|
||||||
var self = this,
|
var self = this,
|
||||||
plaintextItems = [],
|
displayList = [],
|
||||||
encryptedList = [];
|
encryptedList = [];
|
||||||
|
|
||||||
// validate options
|
// validate options
|
||||||
@ -329,7 +329,7 @@ define(function(require) {
|
|||||||
emails.forEach(function(i) {
|
emails.forEach(function(i) {
|
||||||
if (i.body.indexOf(str.cryptPrefix) !== -1 && i.body.indexOf(str.cryptSuffix) !== -1) {
|
if (i.body.indexOf(str.cryptPrefix) !== -1 && i.body.indexOf(str.cryptSuffix) !== -1) {
|
||||||
// add item to plaintext list for display later
|
// add item to plaintext list for display later
|
||||||
plaintextItems.push(i);
|
displayList.push(i);
|
||||||
// parse ct object from ascii armored message block
|
// parse ct object from ascii armored message block
|
||||||
encryptedList.push(parseMessageBlock(i));
|
encryptedList.push(parseMessageBlock(i));
|
||||||
}
|
}
|
||||||
@ -338,13 +338,13 @@ define(function(require) {
|
|||||||
// decrypt items
|
// decrypt items
|
||||||
decryptList(encryptedList, function(err, decryptedList) {
|
decryptList(encryptedList, function(err, decryptedList) {
|
||||||
// replace encrypted subject and body
|
// replace encrypted subject and body
|
||||||
for (var j = 0; j < plaintextItems.length; j++) {
|
for (var j = 0; j < displayList.length; j++) {
|
||||||
plaintextItems[j].subject = decryptedList[j].subject;
|
displayList[j].subject = decryptedList[j].subject;
|
||||||
plaintextItems[j].body = decryptedList[j].body;
|
displayList[j].body = decryptedList[j].body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return only decrypted items
|
// return only decrypted items
|
||||||
callback(null, plaintextItems);
|
callback(null, displayList);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user