mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 06:38:29 +02:00
Allow rules for specific attachment mime types
This commit is contained in:
@@ -194,8 +194,23 @@ public class EntityRule {
|
||||
// Attachments
|
||||
if (jcondition.optBoolean("attachments")) {
|
||||
DB db = DB.getInstance(context);
|
||||
if (db.attachment().getAttachments(message.id).size() == 0)
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||
if (attachments.size() == 0)
|
||||
return false;
|
||||
|
||||
if (jcondition.has("mimetype")) {
|
||||
String mimeType = jcondition.getString("mimetype");
|
||||
|
||||
boolean found = false;
|
||||
for (EntityAttachment attachment : attachments)
|
||||
if (mimeType.equalsIgnoreCase(attachment.type)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Header
|
||||
|
||||
Reference in New Issue
Block a user