Refactoring

pull/200/head
M66B 4 years ago
parent e477763268
commit 2e338e381d

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

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

Loading…
Cancel
Save