From 239d8f8868fe86270f157fbf320ba908e9f6ea8b Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 24 Feb 2022 14:28:54 +0100 Subject: [PATCH] Prevent moving to POP3 inbox for deleted messages --- .../eu/faircode/email/AdapterMessage.java | 52 ++++++++++++++----- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index fd3fdb0122..c4e370a279 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -2010,6 +2010,9 @@ public class AdapterMessage extends RecyclerView.Adapter() { + @Override + protected EntityFolder onExecute(Context context, Bundle args) { + long id = args.getLong("id"); + + DB db = DB.getInstance(context); + return db.folder().getFolderByType(id, EntityFolder.INBOX); + } + + @Override + protected void onExecuted(Bundle args, EntityFolder inbox) { + onActionMove(message, copy, message.account, + new long[]{message.folder, inbox == null ? -1L : inbox.id}); + } + + @Override + protected void onException(Bundle args, Throwable ex) { + Log.unexpectedError(parentFragment.getParentFragmentManager(), ex); + } + }.execute(context, owner, args, "move:pop"); + } else + onActionMove(message, copy, message.account, new long[]{message.folder}); } private void onActionMove(TupleMessageEx message, final boolean copy, long account, long[] disabled) {