From 75fcc16c8b69fe1b186ef3cb3b743307c1f55ea7 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 17 Jan 2022 17:24:15 +0100 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/Core.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index a12b21f3c9..0226eb2fc6 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -395,7 +395,12 @@ class Core { Log.w(folder.name + " ignored=" + op.name); } else { - ensureUid(context, account, folder, message, op, (IMAPFolder) ifolder); + List messages = new ArrayList<>(); + messages.add(message); + if (similar.size() == 0) + ensureUid(context, account, folder, message, op, (IMAPFolder) ifolder); + else + messages.addAll(similar.values()); switch (op.name) { case EntityOperation.SEEN: @@ -422,13 +427,9 @@ class Core { onAdd(context, jargs, account, folder, message, (IMAPStore) istore, (IMAPFolder) ifolder, state); break; - case EntityOperation.MOVE: { - List messages = new ArrayList<>(); - messages.add(message); - messages.addAll(similar.values()); + case EntityOperation.MOVE: onMove(context, jargs, false, account, folder, messages, (IMAPStore) istore, (IMAPFolder) ifolder, state); break; - } case EntityOperation.COPY: onMove(context, jargs, true, account, folder, Arrays.asList(message), (IMAPStore) istore, (IMAPFolder) ifolder, state); @@ -438,13 +439,9 @@ class Core { onFetch(context, jargs, folder, (IMAPStore) istore, (IMAPFolder) ifolder, state); break; - case EntityOperation.DELETE: { - List messages = new ArrayList<>(); - messages.add(message); - messages.addAll(similar.values()); + case EntityOperation.DELETE: onDelete(context, jargs, account, folder, messages, (IMAPFolder) ifolder); break; - } case EntityOperation.HEADERS: onHeaders(context, jargs, folder, message, (IMAPFolder) ifolder);