Synchronize all deleted messages

This commit is contained in:
M66B 2019-01-01 18:43:53 +01:00
parent fdbf0e58c8
commit 8c3e1bba4d
2 changed files with 12 additions and 3 deletions

View File

@ -250,9 +250,9 @@ public interface DaoMessage {
@Query("SELECT uid FROM message" +
" WHERE folder = :folder" +
" AND received >= :received" +
" AND (received IS NULL OR received >= :received)" +
" AND NOT uid IS NULL")
List<Long> getUids(long folder, long received);
List<Long> getUids(long folder, Long received);
@Insert
long insertMessage(EntityMessage message);

View File

@ -2090,7 +2090,7 @@ public class ServiceSynchronize extends LifecycleService {
Log.i(folder.name + " local old=" + old);
// Get list of local uids
List<Long> uids = db.message().getUids(folder.id, sync_time);
List<Long> uids = db.message().getUids(folder.id, null);
Log.i(folder.name + " local count=" + uids.size());
// Reduce list of local uids
@ -2123,6 +2123,15 @@ public class ServiceSynchronize extends LifecycleService {
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
}
long[] auids = Helper.toLongArray(uids);
Message[] iuids = ifolder.getMessagesByUID(auids);
for (int i = 0; i < iuids.length; i++)
if (iuids[i] != null)
uids.remove(auids[i]);
long getuid = SystemClock.elapsedRealtime();
Log.i(folder.name + " remote getuid=" + (SystemClock.elapsedRealtime() - getuid) + " ms");
// Delete local messages not at remote
Log.i(folder.name + " delete=" + uids.size());
for (Long uid : uids) {