Prevent classification loop

This commit is contained in:
M66B 2021-01-04 12:21:51 +01:00
parent b45e85a7bc
commit d35f04d668
2 changed files with 16 additions and 13 deletions

View File

@ -189,7 +189,7 @@ public class EntityOperation {
autounflag = false;
}
boolean auto_classified = false;
boolean auto_classified = message.auto_classified;
if (jargs.opt(2) != null) {
auto_classified = jargs.getBoolean(2);
jargs.remove(2);

View File

@ -94,7 +94,8 @@ public class MessageClassifier {
" message=" + message.id +
"@" + new Date(message.received) +
":" + message.subject +
" class=" + classified);
" class=" + classified +
" re=" + message.auto_classified);
Integer m = classMessages.get(account.id).get(folder.name);
if (target == null) {
@ -108,21 +109,23 @@ public class MessageClassifier {
dirty = true;
if (classified != null) {
EntityFolder f = db.folder().getFolderByName(account.id, classified);
if (f != null && !f.id.equals(folder.id) && f.auto_classify &&
(EntityFolder.JUNK.equals(f.type) || ActivityBilling.isPro(context)))
try {
db.beginTransaction();
if (classified != null && !message.auto_classified)
try {
db.beginTransaction();
EntityFolder f = db.folder().getFolderByName(account.id, classified);
if (f != null && !f.id.equals(folder.id) && f.auto_classify &&
(EntityFolder.JUNK.equals(f.type) || ActivityBilling.isPro(context))) {
EntityOperation.queue(context, message, EntityOperation.MOVE, f.id, false, true);
message.ui_hide = true;
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
} catch (Throwable ex) {
Log.e(ex);
}