1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Find POP3 delete

This commit is contained in:
M66B 2019-11-11 14:44:05 +01:00
parent 1726989ef0
commit 88d2dcaff4

View file

@ -276,7 +276,7 @@ class Core {
break;
case EntityOperation.DELETE:
onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, state);
onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, (POP3Store) istore, state);
break;
case EntityOperation.SYNC:
@ -986,18 +986,27 @@ class Core {
}
}
private static void onDelete(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, POP3Folder ifolder, State state) throws MessagingException {
private static void onDelete(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, POP3Folder ifolder, POP3Store istore, State state) throws MessagingException {
// Delete message
DB db = DB.getInstance(context);
if (!account.browse && EntityFolder.INBOX.equals(folder.type)) {
Map<String, String> caps = istore.capabilities();
Message[] imessages = ifolder.getMessages();
Log.i(folder.name + " POP messages=" + imessages.length);
boolean found = false;
for (Message imessage : imessages) {
MessageHelper helper = new MessageHelper((MimeMessage) imessage);
String msgid = helper.getMessageID();
String msgid;
if (caps.containsKey("UIDL"))
msgid = ifolder.getUID(imessage);
else
msgid = helper.getMessageID();
Log.i("POP searching=" + message.msgid + " iterate=" + msgid);
if (msgid != null && msgid.equals(message.msgid)) {
found = true;
Log.i(folder.name + " POP delete=" + msgid);