Fixed reappearing POP3 messages

pull/210/head
M66B 2 years ago
parent 962104a116
commit f20c080a1c

@ -3136,8 +3136,7 @@ class Core {
for (int i = imessages.length - max; i < imessages.length; i++) { for (int i = imessages.length - max; i < imessages.length; i++) {
Message imessage = imessages[i]; Message imessage = imessages[i];
MessageHelper helper = new MessageHelper((MimeMessage) imessage, context); MessageHelper helper = new MessageHelper((MimeMessage) imessage, context);
String msgid = helper.getMessageID(); // expensive! String msgid = helper.getPOP3MessageID(); // expensive!
if (!TextUtils.isEmpty(msgid))
known.remove(msgid); known.remove(msgid);
} }
@ -3175,15 +3174,7 @@ class Core {
} }
} else { } else {
uidl = null; uidl = null;
msgid = helper.getMessageID(); msgid = helper.getPOP3MessageID();
if (TextUtils.isEmpty(msgid)) {
Long time = helper.getSent();
if (time == null)
msgid = helper.getHash();
else
msgid = Long.toString(time);
}
} }
if (TextUtils.isEmpty(msgid)) { if (TextUtils.isEmpty(msgid)) {

@ -1277,6 +1277,19 @@ public class MessageHelper {
return (header == null ? null : MimeUtility.unfold(header)); return (header == null ? null : MimeUtility.unfold(header));
} }
@NonNull
String getPOP3MessageID() throws MessagingException {
String msgid = getMessageID();
if (TextUtils.isEmpty(msgid)) {
Long time = getSent();
if (time == null)
msgid = getHash();
else
msgid = Long.toString(time);
}
return msgid;
}
List<Header> getAllHeaders() throws MessagingException { List<Header> getAllHeaders() throws MessagingException {
ensureHeaders(); ensureHeaders();
return Collections.list(imessage.getAllHeaders()); return Collections.list(imessage.getAllHeaders());

Loading…
Cancel
Save