From f2cf1673d1bcd46fc2fa30cd63bdee4599d92fb5 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 5 Mar 2020 08:33:53 +0100 Subject: [PATCH] Check if folder is open on operations --- .../eu/faircode/email/ServiceSynchronize.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 155e637023..3216f40811 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1209,6 +1209,23 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Log.i(folder.name + " queuing operations=" + added.size() + " init=" + folder.initialize + " poll=" + folder.poll); + executor.submit(new Helper.PriorityRunnable(-1000, 0) { + @Override + public void run() { + try { + Folder ifolder = mapFolders.get(folder); + if (ifolder != null) { + boolean isOpen = ifolder.isOpen(); + Log.i(folder.name + " open=" + isOpen); + if (!isOpen) + state.error(new FolderClosedException(ifolder)); + } + } catch (Throwable ex) { + Log.w(ex); + } + } + }); + // Partition operations by priority boolean offline = (mapFolders.get(folder) == null); List keys = new ArrayList<>();