Prevent downloading headers when not needed

This commit is contained in:
M66B 2021-12-11 16:59:15 +01:00
parent 3e28f12de0
commit ef20425ddf
1 changed files with 16 additions and 8 deletions

View File

@ -3654,13 +3654,6 @@ class Core {
}
}
boolean needsHeaders = EntityRule.needsHeaders(rules);
boolean needsBody = EntityRule.needsBody(rules);
if (needsHeaders || needsBody)
Log.i(folder.name + " needs headers=" + needsHeaders + " body=" + needsBody);
List<Header> headers = (needsHeaders ? helper.getAllHeaders() : null);
String body = (needsBody ? helper.getMessageParts().getHtml(context) : null);
if (message == null) {
Long sent = helper.getSent();
@ -3856,6 +3849,13 @@ class Core {
}
}
boolean needsHeaders = EntityRule.needsHeaders(rules);
boolean needsBody = EntityRule.needsBody(rules);
if (needsHeaders || needsBody)
Log.i(folder.name + " needs headers=" + needsHeaders + " body=" + needsBody);
List<Header> headers = (needsHeaders ? helper.getAllHeaders() : null);
String body = (needsBody ? helper.getMessageParts().getHtml(context) : null);
try {
db.beginTransaction();
@ -4077,7 +4077,14 @@ class Core {
}
}
if (update || process)
if (update || process) {
boolean needsHeaders = EntityRule.needsHeaders(rules);
boolean needsBody = EntityRule.needsBody(rules);
if (needsHeaders || needsBody)
Log.i(folder.name + " needs headers=" + needsHeaders + " body=" + needsBody);
List<Header> headers = (needsHeaders ? helper.getAllHeaders() : null);
String body = (needsBody ? helper.getMessageParts().getHtml(context) : null);
try {
db.beginTransaction();
@ -4090,6 +4097,7 @@ class Core {
} finally {
db.endTransaction();
}
}
if (process) {
EntityContact.received(context, account, folder, message);