Keep sent messages in user folders

pull/198/head
M66B 4 years ago
parent 902213e935
commit a859c1562b

@ -2973,7 +2973,7 @@ class Core {
// Delete not synchronized messages without uid // Delete not synchronized messages without uid
if (!EntityFolder.isOutgoing(folder.type)) { if (!EntityFolder.isOutgoing(folder.type)) {
int orphans = db.message().deleteOrphans(folder.id); int orphans = db.message().deleteOrphans(folder.id, new Date().getTime());
Log.i(folder.name + " deleted orphans=" + orphans); Log.i(folder.name + " deleted orphans=" + orphans);
} }

@ -821,6 +821,7 @@ public interface DaoMessage {
@Query("DELETE FROM message" + @Query("DELETE FROM message" +
" WHERE folder = :folder" + " WHERE folder = :folder" +
" AND uid IS NULL" + " AND uid IS NULL" +
" AND (ui_busy IS NULL OR ui_busy < :now)" +
" AND NOT EXISTS" + " AND NOT EXISTS" +
" (SELECT * FROM operation" + " (SELECT * FROM operation" +
" WHERE operation.message = message.id" + " WHERE operation.message = message.id" +
@ -831,7 +832,7 @@ public interface DaoMessage {
" WHERE o.account = message.account" + " WHERE o.account = message.account" +
" AND o.name = '" + EntityOperation.MOVE + "'" + " AND o.name = '" + EntityOperation.MOVE + "'" +
" AND m.msgid = message.msgid)") " AND m.msgid = message.msgid)")
int deleteOrphans(long folder); int deleteOrphans(long folder, long now);
@Query("SELECT * FROM message" + @Query("SELECT * FROM message" +
" WHERE folder = :folder" + " WHERE folder = :folder" +

@ -594,6 +594,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
message.seen = true; message.seen = true;
message.ui_seen = true; message.ui_seen = true;
message.ui_hide = true; message.ui_hide = true;
message.ui_busy = Long.MAX_VALUE; // Needed to keep messages in user folders
message.error = null; message.error = null;
message.id = db.message().insertMessage(message); message.id = db.message().insertMessage(message);

Loading…
Cancel
Save