Refactoring

This commit is contained in:
M66B 2021-07-29 08:55:34 +02:00
parent e477763268
commit 2e338e381d
2 changed files with 5 additions and 4 deletions

View File

@ -103,7 +103,7 @@ public class MessageClassifier {
if (classified != null &&
!classified.equals(folder.name) &&
!TextUtils.isEmpty(message.msgid) &&
!message.hasKeyword("$Classified") &&
!message.hasKeyword(MessageHelper.FLAG_CLASSIFIED) &&
!accountMsgIds.get(folder.account).contains(message.msgid) &&
!EntityFolder.JUNK.equals(folder.type)) {
boolean pro = ActivityBilling.isPro(context);
@ -115,7 +115,7 @@ public class MessageClassifier {
EntityFolder dest = db.folder().getFolderByName(folder.account, classified);
if (dest != null && dest.auto_classify_target &&
(pro || EntityFolder.JUNK.equals(dest.type))) {
EntityOperation.queue(context, message, EntityOperation.KEYWORD, "$Classified", true);
EntityOperation.queue(context, message, EntityOperation.KEYWORD, MessageHelper.FLAG_CLASSIFIED, true);
EntityOperation.queue(context, message, EntityOperation.MOVE, dest.id, false, true);
message.ui_hide = true;
}

View File

@ -137,12 +137,14 @@ public class MessageHelper {
static final String FLAG_FORWARDED = "$Forwarded";
static final String FLAG_NOT_JUNK = "$NotJunk";
static final String FLAG_CLASSIFIED = "$Classified";
// https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
// Not black listed: Gmail $Phishing
private static final List<String> FLAG_BLACKLIST = Collections.unmodifiableList(Arrays.asList(
MessageHelper.FLAG_FORWARDED,
MessageHelper.FLAG_NOT_JUNK,
MessageHelper.FLAG_CLASSIFIED, // FairEmail
"$MDNSent", // https://tools.ietf.org/html/rfc3503
"$SubmitPending",
"$Submitted",
@ -160,8 +162,7 @@ public class MessageHelper {
"$signed", // Kmail
"$encrypted", // Kmail
"$HasAttachment", // Dovecot
"$HasNoAttachment", // Dovecot
"$Classified" // FairEmail
"$HasNoAttachment" // Dovecot
));
// https://tools.ietf.org/html/rfc4021