1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-28 20:02:16 -05:00

deleting vinbox item after sync works

This commit is contained in:
Tankred Hase 2013-04-23 16:35:01 +02:00
parent e5ed9c708c
commit 669d8002d2
2 changed files with 37 additions and 2 deletions

View File

@ -92,6 +92,29 @@ app.dao.CloudStorage = function(window, $) {
}); });
}; };
/**
* Delete an encrypted item from the cloud
* @param type [String] The type of item e.g. 'email'
*/
this.deleteEncryptedItem = function(id, type, emailAddress, folderName, callback) {
var uri;
uri = app.config.cloudUrl + '/' + type + '/user/' + emailAddress + '/folder/' + folderName + '/' + id;
$.ajax({
url: uri,
type: 'DELETE',
success: function() {
callback();
},
error: function(xhr, textStatus, err) {
callback({
error: err,
status: textStatus
});
}
});
};
/** /**
* Lists the encrypted items * Lists the encrypted items
* @param type [String] The type of item e.g. 'email' * @param type [String] The type of item e.g. 'email'

View File

@ -133,13 +133,19 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
return; return;
} }
// TODO: delete items from virtual inbox // delete asymmetricall encrypted item from virtual inbox
deleteVinboxItem(asymCt, function(err) {
if (err) {
callback(err);
return;
}
after(); // asynchronously iterate through objects after(); // asynchronously iterate through objects
}); });
}); });
}); });
}); });
});
function asymDecryptMail(m, callback) { function asymDecryptMail(m, callback) {
var pubKeyId = m.senderPk.split(';')[1]; var pubKeyId = m.senderPk.split(';')[1];
@ -184,6 +190,12 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
}); });
}); });
} }
function deleteVinboxItem(email, callback) {
cloudstorage.deleteEncryptedItem(email.id, 'email', self.account.get('emailAddress'), 'vinbox', function(err) {
callback(err);
});
}
}; };
/** /**