From 9201686df08c24d9c4360cc24dd66985b21ed93f Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 18 Apr 2020 15:12:43 +0200 Subject: [PATCH] Download latest POP3 messages --- app/src/main/java/eu/faircode/email/Core.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 9369e98384..db5cd1fa9d 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1541,6 +1541,10 @@ class Core { Message[] imessages = ifolder.getMessages(); Log.i(folder.name + " POP messages=" + imessages.length); + if (account.max_messages != null && imessages.length > account.max_messages) + imessages = Arrays.copyOfRange(imessages, + imessages.length - account.max_messages, imessages.length); + if (caps.containsKey("UIDL")) { FetchProfile ifetch = new FetchProfile(); ifetch.add(UIDFolder.FetchProfileItem.UID); @@ -1558,9 +1562,6 @@ class Core { if (!state.isRunning()) return; - if (account.max_messages != null && ++count > account.max_messages) - break; - MessageHelper helper = new MessageHelper((MimeMessage) imessage); String msgid;