Make sure move marks seen / remove flags

pull/162/head
M66B 5 years ago
parent cba79bbe1e
commit bfc04d2ae2

@ -763,6 +763,9 @@ class Core {
// Get arguments // Get arguments
long id = jargs.getLong(0); long id = jargs.getLong(0);
boolean seen = jargs.optBoolean(1);
boolean unflag = jargs.optBoolean(3);
Flags flags = ifolder.getPermanentFlags(); Flags flags = ifolder.getPermanentFlags();
// Get target folder // Get target folder
@ -813,19 +816,15 @@ class Core {
itarget.appendMessages(icopies.toArray(new Message[0])); itarget.appendMessages(icopies.toArray(new Message[0]));
} else { } else {
for (Message imessage : map.keySet()) { for (Message imessage : map.keySet()) {
EntityMessage message = map.get(imessage); Log.i("Move seen=" + seen + " unflag=" + unflag);
// Auto read // Mark read
if (flags.contains(Flags.Flag.SEEN)) if (seen && flags.contains(Flags.Flag.SEEN))
imessage.setFlag(Flags.Flag.SEEN, message.ui_seen); imessage.setFlag(Flags.Flag.SEEN, true);
// Auto unflag // Remove star
if (flags.contains(Flags.Flag.FLAGGED)) if (unflag && flags.contains(Flags.Flag.FLAGGED))
imessage.setFlag(Flags.Flag.FLAGGED, message.ui_flagged); imessage.setFlag(Flags.Flag.FLAGGED, false);
// Answered fix
if (flags.contains(Flags.Flag.ANSWERED))
imessage.setFlag(Flags.Flag.ANSWERED, message.ui_answered);
} }
ifolder.copyMessages(map.keySet().toArray(new Message[0]), itarget); ifolder.copyMessages(map.keySet().toArray(new Message[0]), itarget);
@ -854,17 +853,13 @@ class Core {
if (draft) { if (draft) {
Message icopy = itarget.getMessageByUID(uid); Message icopy = itarget.getMessageByUID(uid);
// Auto read // Mark read
if (flags.contains(Flags.Flag.SEEN)) if (seen && flags.contains(Flags.Flag.SEEN))
icopy.setFlag(Flags.Flag.SEEN, message.ui_seen); icopy.setFlag(Flags.Flag.SEEN, true);
// Auto unflag
if (flags.contains(Flags.Flag.FLAGGED))
icopy.setFlag(Flags.Flag.FLAGGED, message.ui_flagged);
// Answered fix // Remove star
if (flags.contains(Flags.Flag.ANSWERED)) if (unflag && flags.contains(Flags.Flag.FLAGGED))
icopy.setFlag(Flags.Flag.ANSWERED, message.ui_answered); icopy.setFlag(Flags.Flag.FLAGGED, false);
// Set drafts flag // Set drafts flag
icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type)); icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type));

@ -140,15 +140,18 @@ public class EntityOperation {
else if (MOVE.equals(name)) { else if (MOVE.equals(name)) {
// Parameters: // Parameters:
// 0: target folder // 0: target folder
// 1: mark read (rule) // 1: mark seen
// 2: temporary message // 2: temporary message
// 3: remove flag
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autoread = prefs.getBoolean("autoread", false); boolean autoread = prefs.getBoolean("autoread", false);
boolean autounflag = prefs.getBoolean("autounflag", false); boolean autounflag = prefs.getBoolean("autounflag", false);
if (jargs.optBoolean(1)) if (jargs.optBoolean(1)) // rule
autoread = true; autoread = true;
jargs.put(1, autoread);
jargs.put(3, autounflag);
EntityFolder source = db.folder().getFolder(message.folder); EntityFolder source = db.folder().getFolder(message.folder);
EntityFolder target = db.folder().getFolder(jargs.getLong(0)); EntityFolder target = db.folder().getFolder(jargs.getLong(0));

Loading…
Cancel
Save