fixed the webapp so it removes non-existing msgs from the cache

This commit is contained in:
dickreckard 2014-05-28 12:02:01 +02:00
parent 87ed307ac5
commit fdc3d06675

View File

@ -114,7 +114,6 @@ function doStuffForEach( entriesString, stuffFunction ) {
* INBOX STUFF * INBOX STUFF
*/ */
function updateInboxView() { function updateInboxView() {
localStorage.clear();
var contentString = ''; var contentString = '';
for(var i in localStorage) for(var i in localStorage)
{ {
@ -133,21 +132,20 @@ function onMessageDownload( msg, filename ) {
updateInboxView(); updateInboxView();
} }
function onIndex( index ) { function onIndex( index ) {
var lines = index.split( /\n/ );
/* NON WORKING MOD
for(var k in localStorage){ for(var k in localStorage){
var l = 1; var l = 1;
for ( var i in lines ) { for ( var i in lines ) {
if (i == k){ l = 0; } var f = lines[i];
if (f == k){ l = 0; }
} }
if (l == 1){ if (l == 1){
localStorage.removeItem(k); localStorage.removeItem(k);
} }
} }
updateInboxView(); updateInboxView();
*/
var lines = index.split( /\n/ );
for ( var i in lines ) { for ( var i in lines ) {
var fname = lines[i]; var fname = lines[i];
if ( localStorage.getItem( fname ) === null ) { if ( localStorage.getItem( fname ) === null ) {