Optimized POP3 UIDL delete

pull/184/head
M66B 4 years ago
parent 0e4239553f
commit c5eb18ed80

@ -1253,21 +1253,26 @@ class Core {
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 hasUidl = caps.containsKey("UIDL");
if (hasUidl) {
FetchProfile ifetch = new FetchProfile();
ifetch.add(UIDFolder.FetchProfileItem.UID);
ifolder.fetch(imessages, ifetch);
}
boolean found = false; boolean found = false;
for (Message imessage : imessages) { for (Message imessage : imessages) {
MessageHelper helper = new MessageHelper((MimeMessage) imessage, context); MessageHelper helper = new MessageHelper((MimeMessage) imessage, context);
String msgid; String uidl = (hasUidl ? ifolder.getUID(imessage) : null);
if (caps.containsKey("UIDL")) String msgid = helper.getMessageID();
msgid = ifolder.getUID(imessage);
else
msgid = helper.getMessageID();
Log.i(folder.name + " POP searching=" + message.msgid + " iterate=" + msgid); Log.i(folder.name + " POP searching=" + message.uidl + "/" + message.msgid +
if (msgid != null && " iterate=" + uidl + "/" + msgid);
(msgid.equals(message.uidl) || msgid.equals(message.msgid))) { if ((uidl != null && uidl.equals(message.uidl)) ||
(msgid != null && msgid.equals(message.msgid))) {
found = true; found = true;
Log.i(folder.name + " POP delete=" + msgid); Log.i(folder.name + " POP delete=" + uidl + "/" + msgid);
imessage.setFlag(Flags.Flag.DELETED, true); imessage.setFlag(Flags.Flag.DELETED, true);
break; break;
} }
@ -1937,7 +1942,7 @@ class Core {
} }
try { try {
Log.i(folder.name + " POP sync=" + msgid); Log.i(folder.name + " POP sync=" + uidl + "/" + msgid);
Long sent = helper.getSent(); Long sent = helper.getSent();
Long received = helper.getReceivedHeader(); Long received = helper.getReceivedHeader();

Loading…
Cancel
Save