Conditionally locally move

pull/147/head
M66B 6 years ago
parent dc579b1309
commit f595f28122

@ -25,6 +25,7 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -148,9 +149,18 @@ public class EntityOperation {
if (!EntityFolder.ARCHIVE.equals(source.type) || EntityFolder.TRASH.equals(target.type)) if (!EntityFolder.ARCHIVE.equals(source.type) || EntityFolder.TRASH.equals(target.type))
db.message().setMessageUiHide(message.id, true); 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 // Create copy without uid in target folder
// Message with same msgid can be in archive and source 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 id = message.id;
long uid = message.uid; long uid = message.uid;
message.id = null; message.id = null;

Loading…
Cancel
Save