From 214ee5b52b05e5d5fe205b304766972990ddf0a2 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 28 Apr 2021 08:09:45 +0200 Subject: [PATCH] Label classified messages --- app/src/main/java/eu/faircode/email/AdapterMessage.java | 4 ++-- app/src/main/java/eu/faircode/email/EntityMessage.java | 4 ++-- app/src/main/java/eu/faircode/email/MessageClassifier.java | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 58e6e4d73a..def10baa19 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -1084,7 +1084,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? View.VISIBLE : View.GONE); if (viewType == ViewType.FOLDER) diff --git a/app/src/main/java/eu/faircode/email/EntityMessage.java b/app/src/main/java/eu/faircode/email/EntityMessage.java index b99aaf55a1..9889239e68 100644 --- a/app/src/main/java/eu/faircode/email/EntityMessage.java +++ b/app/src/main/java/eu/faircode/email/EntityMessage.java @@ -282,10 +282,10 @@ public class EntityMessage implements Serializable { return addresses.toArray(new Address[0]); } - boolean isForwarded() { + boolean hasKeyword(@NonNull String value) { if (keywords != null) for (String keyword : keywords) - if ("$Forwarded".equalsIgnoreCase(keyword)) + if (value.equalsIgnoreCase(keyword)) return true; return false; } diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index 8935077f84..b7705d4488 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -104,6 +104,7 @@ public class MessageClassifier { if (classified != null && !classified.equals(folder.name) && !TextUtils.isEmpty(message.msgid) && + !message.hasKeyword("$Classified") && !accountMsgIds.get(folder.account).contains(message.msgid) && !EntityFolder.JUNK.equals(folder.type)) { boolean pro = ActivityBilling.isPro(context); @@ -115,6 +116,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.MOVE, dest.id, false, true); message.ui_hide = true; }