|
|
|
@ -2917,15 +2917,13 @@ class Core {
|
|
|
|
|
// Deferred rule (download headers, body, etc)
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
long id = jargs.getLong(0);
|
|
|
|
|
if (id < 0) {
|
|
|
|
|
List<EntityRule> rules = db.rule().getEnabledRules(message.folder, true);
|
|
|
|
|
for (EntityRule rule : rules)
|
|
|
|
|
if (rule.matches(context, message, null, null)) {
|
|
|
|
|
rule.execute(context, message);
|
|
|
|
|
if (rule.stop)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
EntityRule.run(context, rules, message, null, null);
|
|
|
|
|
} else {
|
|
|
|
|
EntityRule rule = db.rule().getRule(id);
|
|
|
|
|
if (rule == null)
|
|
|
|
@ -2936,6 +2934,11 @@ class Core {
|
|
|
|
|
|
|
|
|
|
rule.execute(context, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
|
} finally {
|
|
|
|
|
db.endTransaction();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void onDownload(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws MessagingException, IOException, JSONException {
|
|
|
|
@ -4952,13 +4955,9 @@ class Core {
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
try {
|
|
|
|
|
boolean executed = false;
|
|
|
|
|
if (pro)
|
|
|
|
|
for (EntityRule rule : rules)
|
|
|
|
|
if (rule.matches(context, message, headers, html)) {
|
|
|
|
|
rule.execute(context, message);
|
|
|
|
|
executed = true;
|
|
|
|
|
if (rule.stop)
|
|
|
|
|
break;
|
|
|
|
|
if (pro) {
|
|
|
|
|
int applied = EntityRule.run(context, rules, message, headers, html);
|
|
|
|
|
executed = (applied > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (EntityFolder.INBOX.equals(folder.type))
|
|
|
|
|