From 774f97819d30a6158ac97a0ecd137a9200d55f4f Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 27 Sep 2019 15:32:29 +0200 Subject: [PATCH] Fetch after move only if folder disabled or no idle --- app/src/main/java/eu/faircode/email/Core.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 9fbb9085b6..e4c1799036 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -720,22 +720,24 @@ class Core { ifolder.expunge(); } - // Fetch appended/copied - try { - itarget.open(READ_WRITE); + // Fetch appended/copied when needed + if (!TextUtils.isEmpty(message.msgid) && + (!folder.synchronize || !istore.hasCapability("IDLE"))) try { - Long uid = findUid(itarget, message.msgid, false); - if (uid != null) { - JSONArray fargs = new JSONArray(); - fargs.put(uid); - onFetch(context, fargs, target, itarget, state); + itarget.open(READ_WRITE); + try { + Long uid = findUid(itarget, message.msgid, false); + if (uid != null) { + JSONArray fargs = new JSONArray(); + fargs.put(uid); + onFetch(context, fargs, target, itarget, state); + } + } finally { + itarget.close(); } - } finally { - itarget.close(); + } catch (Throwable ex) { + Log.w(ex); } - } catch (Throwable ex) { - Log.w(ex); - } // Delete junk contacts if (EntityFolder.JUNK.equals(target.type)) {