From 6839eef7f816dd0c4a9ab912433dfd06434e79b5 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 14 Jun 2019 10:42:54 +0200 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/Core.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index f83cb23d05..4221d7ff9f 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -155,14 +155,15 @@ class Core { JSONArray jargs = new JSONArray(op.args); try { - if (message == null && - !EntityOperation.SYNC.equals(op.name) && - !EntityOperation.SUBSCRIBE.equals(op.name)) - throw new MessageRemovedException(); - db.operation().setOperationError(op.id, null); + if (!EntityOperation.SYNC.equals(op.name)) + db.operation().setOperationState(op.id, "executing"); - if (message != null) { + if (message == null) { + if (!EntityOperation.SYNC.equals(op.name) && + !EntityOperation.SUBSCRIBE.equals(op.name)) + throw new MessageRemovedException(); + } else { db.message().setMessageError(message.id, null); if (!EntityOperation.ADD.equals(op.name)) ensureUid(context, folder, message, (IMAPFolder) ifolder); @@ -170,9 +171,6 @@ class Core { // Operations should use database transaction when needed - if (!EntityOperation.SYNC.equals(op.name)) - db.operation().setOperationState(op.id, "executing"); - switch (op.name) { case EntityOperation.SEEN: onSeen(context, jargs, folder, message, (IMAPFolder) ifolder);