From 54db9dc2906149eb0c2b626241a8432c8d52d3cb Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 26 Apr 2021 10:12:29 +0200 Subject: [PATCH] Download headers/EML fixes/improvements --- app/src/main/java/eu/faircode/email/Core.java | 10 +++++++++- .../java/eu/faircode/email/ServiceSynchronize.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 4daafd0cab..3ab8d27876 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -3499,6 +3499,12 @@ class Core { " labels=" + (labels == null ? null : TextUtils.join(" ", labels))); } + if (download_headers && message.headers == null) { + update = true; + message.headers = helper.getHeaders(); + Log.i(folder.name + " updated id=" + message.id + " headers"); + } + if (message.hash == null || process) { update = true; message.hash = helper.getHash(); @@ -3791,13 +3797,15 @@ class Core { } if (download_eml && + (message.raw == null || !message.raw) && (state.getNetworkState().isUnmetered() || (message.total != null && message.total < maxSize))) { File file = message.getRawFile(context); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { imessage.writeTo(os); } - db.message().setMessageRaw(message.id, true); + message.raw = true; + db.message().setMessageRaw(message.id, message.raw); } return fetch; diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 7e2cd9a452..a19a6888b1 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -147,6 +147,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences "sync_kept", "sync_folders", "sync_shared_folders", + "download_headers", "download_eml", "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect "experiments", "debug", "protocol", // force reconnect "auth_plain", "auth_login", "auth_ntlm", "auth_sasl" // force reconnect