Fixed POP3 *not* delete

pull/178/head
M66B 5 years ago
parent 33d0ac0868
commit 2368dc8727

@ -1051,49 +1051,50 @@ class Core {
// Delete message // Delete message
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
if (!account.leave_deleted && if (EntityFolder.INBOX.equals(folder.type)) {
EntityFolder.INBOX.equals(folder.type)) { if (account.leave_deleted)
Map<String, String> caps = istore.capabilities(); db.message().setMessageUiHide(message.id, true);
else {
Map<String, String> caps = istore.capabilities();
Message[] imessages = ifolder.getMessages(); Message[] imessages = ifolder.getMessages();
Log.i(folder.name + " POP messages=" + imessages.length); Log.i(folder.name + " POP messages=" + imessages.length);
boolean found = false; boolean found = false;
for (Message imessage : imessages) { for (Message imessage : imessages) {
MessageHelper helper = new MessageHelper((MimeMessage) imessage); MessageHelper helper = new MessageHelper((MimeMessage) imessage);
String msgid; String msgid;
if (caps.containsKey("UIDL")) if (caps.containsKey("UIDL"))
msgid = ifolder.getUID(imessage); msgid = ifolder.getUID(imessage);
else else
msgid = helper.getMessageID(); msgid = helper.getMessageID();
Log.i("POP searching=" + message.msgid + " iterate=" + msgid); Log.i("POP searching=" + message.msgid + " iterate=" + msgid);
if (msgid != null && msgid.equals(message.msgid)) { if (msgid != null && msgid.equals(message.msgid)) {
found = true; found = true;
Log.i(folder.name + " POP delete=" + msgid); Log.i(folder.name + " POP delete=" + msgid);
imessage.setFlag(Flags.Flag.DELETED, true); imessage.setFlag(Flags.Flag.DELETED, true);
break; break;
}
} }
}
Log.i(folder.name + " POP expunge=" + found); Log.i(folder.name + " POP expunge=" + found);
if (found) if (found)
try { try {
ifolder.close(true); ifolder.close(true);
ifolder.open(Folder.READ_WRITE); ifolder.open(Folder.READ_WRITE);
db.message().deleteMessage(folder.id, message.id);
} catch (Throwable ex) {
Log.e(ex);
state.error(new FolderClosedException(ifolder, "POP"));
}
else
db.message().deleteMessage(folder.id, message.id); db.message().deleteMessage(folder.id, message.id);
} catch (Throwable ex) { }
Log.e(ex); } else
state.error(new FolderClosedException(ifolder, "POP")); db.message().deleteMessage(folder.id, message.id);
}
else
db.message().deleteMessage(folder.id, message.id);
} else {
if (!EntityFolder.INBOX.equals(folder.type))
db.message().deleteMessage(folder.id, message.id);
}
if (!EntityFolder.DRAFTS.equals(folder.type) && if (!EntityFolder.DRAFTS.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type)) { !EntityFolder.TRASH.equals(folder.type)) {

Loading…
Cancel
Save