diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 527de8cd66..cdfcd7940c 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -586,6 +586,16 @@ class Core { }); } + static boolean isAlive(IMAPFolder ifolder) { + try { + noop(ifolder); + } catch (MessagingException ex) { + Log.i(ifolder.getFullName(), ex); + return false; + } + return true; + } + private static void onSeen(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder) throws MessagingException, JSONException { // Mark message (un)seen DB db = DB.getInstance(context); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 3a0b0d381f..5f62562f90 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1346,7 +1346,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (folder.synchronize) if (!folder.poll && capIdle) { // Sends folder NOOP - if (!mapFolders.get(folder).isOpen()) + if (!Core.isAlive(mapFolders.get(folder))) throw new StoreClosedException(iservice.getStore(), folder.name); } else { if (folder.poll_count == 0)