Flag junk/no junk

pull/206/head
M66B 3 years ago
parent 5d956eb77f
commit 5fbed5ef34

@ -1330,10 +1330,21 @@ class Core {
imessage.setFlag(Flags.Flag.FLAGGED, false);
// Mark not spam
if (EntityFolder.JUNK.equals(folder.type) &&
ifolder.getPermanentFlags().contains(Flags.Flag.USER)) {
if (!copy && ifolder.getPermanentFlags().contains(Flags.Flag.USER)) {
Flags junk = new Flags(MessageHelper.FLAG_JUNK);
Flags notJunk = new Flags(MessageHelper.FLAG_NOT_JUNK);
imessage.setFlags(notJunk, true);
List<String> userFlags = Arrays.asList(imessage.getFlags().getUserFlags());
if (EntityFolder.JUNK.equals(target.type)) {
// To junk
if (userFlags.contains(MessageHelper.FLAG_NOT_JUNK))
imessage.setFlags(notJunk, false);
imessage.setFlags(junk, true);
} else if (EntityFolder.JUNK.equals(folder.type)) {
// From junk
if (userFlags.contains(MessageHelper.FLAG_JUNK))
imessage.setFlags(junk, false);
imessage.setFlags(notJunk, true);
}
}
}

@ -145,6 +145,7 @@ public class MessageHelper {
));
static final String FLAG_FORWARDED = "$Forwarded";
static final String FLAG_JUNK = "$Junk";
static final String FLAG_NOT_JUNK = "$NotJunk";
static final String FLAG_CLASSIFIED = "$Classified";
static final String FLAG_FILTERED = "$Filtered";
@ -153,13 +154,13 @@ public class MessageHelper {
// Not black listed: Gmail $Phishing
private static final List<String> FLAG_BLACKLIST = Collections.unmodifiableList(Arrays.asList(
MessageHelper.FLAG_FORWARDED,
MessageHelper.FLAG_JUNK,
MessageHelper.FLAG_NOT_JUNK,
MessageHelper.FLAG_CLASSIFIED, // FairEmail
MessageHelper.FLAG_FILTERED, // FairEmail
"$MDNSent", // https://tools.ietf.org/html/rfc3503
"$SubmitPending",
"$Submitted",
"$Junk",
"Junk",
"NonJunk",
"$recent",

Loading…
Cancel
Save