1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-03 13:44:40 +00:00

Conditionally locally move

This commit is contained in:
M66B 2019-01-08 07:13:44 +00:00
parent dc579b1309
commit f595f28122

View file

@ -25,6 +25,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -148,9 +149,18 @@ public class EntityOperation {
if (!EntityFolder.ARCHIVE.equals(source.type) || EntityFolder.TRASH.equals(target.type))
db.message().setMessageUiHide(message.id, true);
Calendar cal_keep = Calendar.getInstance();
cal_keep.add(Calendar.DAY_OF_MONTH, -target.keep_days);
cal_keep.set(Calendar.HOUR_OF_DAY, 0);
cal_keep.set(Calendar.MINUTE, 0);
cal_keep.set(Calendar.SECOND, 0);
cal_keep.set(Calendar.MILLISECOND, 0);
// Create copy without uid in target folder
// Message with same msgid can be in archive and source folder
if (db.message().countMessageByMsgId(target.id, message.msgid) == 0) {
if (target.synchronize &&
message.received > cal_keep.getTimeInMillis() &&
db.message().countMessageByMsgId(target.id, message.msgid) == 0) {
long id = message.id;
long uid = message.uid;
message.id = null;