mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 00:23:09 +02:00
Stop rule group
This commit is contained in:
@@ -159,6 +159,31 @@ public class EntityRule {
|
||||
return false;
|
||||
}
|
||||
|
||||
static int run(Context context, List<EntityRule> rules,
|
||||
EntityMessage message, List<Header> headers, String html)
|
||||
throws JSONException, MessagingException {
|
||||
int applied = 0;
|
||||
|
||||
List<String> stopped = new ArrayList<>();
|
||||
for (EntityRule rule : rules) {
|
||||
if (rule.group != null && stopped.contains(rule.group))
|
||||
continue;
|
||||
if (rule.matches(context, message, headers, html)) {
|
||||
if (rule.execute(context, message))
|
||||
applied++;
|
||||
if (rule.stop)
|
||||
if (rule.group == null)
|
||||
break;
|
||||
else {
|
||||
if (!stopped.contains(rule.group))
|
||||
stopped.add(rule.group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return applied;
|
||||
}
|
||||
|
||||
boolean matches(Context context, EntityMessage message, List<Header> headers, String html) throws MessagingException {
|
||||
try {
|
||||
JSONObject jcondition = new JSONObject(condition);
|
||||
|
||||
Reference in New Issue
Block a user