Auto classify depends on download

This commit is contained in:
M66B
2021-01-02 22:52:41 +01:00
parent bce800a855
commit 8d5268877f
5 changed files with 41 additions and 30 deletions

View File

@@ -42,6 +42,7 @@ import java.util.Map;
public class MessageClassifier {
private static boolean loaded = false;
private static boolean dirty = false;
private static Map<Long, Map<String, Integer>> classMessages = new HashMap<>();
private static Map<Long, Map<String, Map<String, Integer>>> wordClassFrequency = new HashMap<>();
@@ -106,9 +107,11 @@ public class MessageClassifier {
}
Log.i("Classifier classify=" + folder.name + " messages=" + classMessages.get(account.id).get(folder.name));
dirty = true;
if (classified != null) {
EntityFolder f = db.folder().getFolderByName(account.id, classified);
if (f != null && f.auto_classify && !f.id.equals(folder.id))
if (f != null && f.download && f.auto_classify && !f.id.equals(folder.id))
EntityOperation.queue(context, message, EntityOperation.MOVE, f.id);
}
}
@@ -220,7 +223,7 @@ public class MessageClassifier {
}
static synchronized void save(Context context) throws JSONException, IOException {
if (!loaded)
if (!dirty)
return;
if (!isEnabled(context))
return;