Added retry for sent orphans

This commit is contained in:
M66B 2021-02-05 09:17:34 +01:00
parent 9b587e59dd
commit 0223efaf8a
2 changed files with 16 additions and 0 deletions

View File

@ -805,6 +805,15 @@ public interface DaoMessage {
" AND m.msgid = message.msgid)")
int deleteOrphans(long folder);
@Query("SELECT * FROM message" +
" WHERE folder = :folder" +
" AND uid IS NULL" +
" AND NOT EXISTS" +
" (SELECT * FROM operation" +
" WHERE operation.message = message.id" +
" AND operation.name = '" + EntityOperation.EXISTS + "')")
List<EntityMessage> getSentOrphans(long folder);
@Query("SELECT id FROM message" +
" WHERE folder = :folder" +
" AND received < :before" +

View File

@ -1519,6 +1519,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
force = true;
}
}
if (EntityFolder.SENT.equals(folder.type)) {
List<EntityMessage> orphans = db.message().getSentOrphans(folder.id);
if (orphans != null)
for (EntityMessage orphan : orphans)
EntityOperation.queue(context, orphan, EntityOperation.EXISTS);
}
}
db.setTransactionSuccessful();