1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 12:22:22 -05:00

remove [whiteout] tag from plain text messages

This commit is contained in:
Felix Hammerl 2013-12-04 17:35:44 +01:00
parent 9e41626182
commit f9c196e2ee
2 changed files with 9 additions and 3 deletions

View File

@ -490,6 +490,8 @@ define(function(require) {
} }
function handleMessage(message, localCallback) { function handleMessage(message, localCallback) {
message.subject = message.subject.split(str.subjectPrefix)[1];
if (containsArmoredCiphertext(message)) { if (containsArmoredCiphertext(message)) {
decrypt(message, localCallback); decrypt(message, localCallback);
return; return;
@ -679,7 +681,7 @@ define(function(require) {
// build encrypted text body // build encrypted text body
email.body = greeting + message + ct + signature; email.body = greeting + message + ct + signature;
email.subject = email.subject; email.subject = str.subjectPrefix + email.subject;
} }
}; };
@ -860,6 +862,7 @@ define(function(require) {
mails.forEach(function(mail) { mails.forEach(function(mail) {
mail.body = str.cryptPrefix + mail.body.split(str.cryptPrefix)[1].split(str.cryptSuffix)[0] + str.cryptSuffix; mail.body = str.cryptPrefix + mail.body.split(str.cryptPrefix)[1].split(str.cryptSuffix)[0] + str.cryptSuffix;
mail.subject = mail.subject.split(str.subjectPrefix)[1];
self._crypto.decrypt(mail.body, ownKeys.publicKeyArmored, function(err, decrypted) { self._crypto.decrypt(mail.body, ownKeys.publicKeyArmored, function(err, decrypted) {
mail.body = err ? err.errMsg : decrypted; mail.body = err ? err.errMsg : decrypted;
after(); after();

View File

@ -54,7 +54,7 @@ define(function(require) {
to: [{ to: [{
address: 'qwe@qwe.de' address: 'qwe@qwe.de'
}], }],
subject: '[whiteout] qweasd', subject: 'qweasd',
body: 'asd' body: 'asd'
}; };
nonWhitelistedMail = { nonWhitelistedMail = {
@ -592,7 +592,10 @@ define(function(require) {
pgpStub.decrypt.withArgs(dummyEncryptedMail.body, mockKeyPair.publicKey).yields(null, dummyDecryptedMail.body); pgpStub.decrypt.withArgs(dummyEncryptedMail.body, mockKeyPair.publicKey).yields(null, dummyDecryptedMail.body);
imapListStub = sinon.stub(dao, '_imapListMessages').withArgs({ imapListStub = sinon.stub(dao, '_imapListMessages').withArgs({
folder: folder folder: folder
}).yields(null, [dummyEncryptedMail]); }).yields(null, [{
uid: dummyEncryptedMail.uid,
subject: '[whiteout] ' + dummyEncryptedMail // the object has already been manipulated as a side-effect...
}]);
dao.sync({ dao.sync({
folder: folder folder: folder