Simplification

This commit is contained in:
M66B 2023-07-19 19:39:13 +02:00
parent 4c1e7eda7e
commit 8d22039163
1 changed files with 7 additions and 17 deletions

View File

@ -2258,24 +2258,14 @@ class Core {
throw new IllegalArgumentException("exists without msgid");
// Search for message
Message[] imessages = (account.isOutlook())
? ifolder.search(new HeaderTerm("X-Microsoft-Original-Message-ID", message.msgid))
: ifolder.search(new MessageIDTerm(message.msgid));
// Alternative, inconsistent for Outlook: X-Microsoft-Original-Message-ID
Message[] imessages = ifolder.search(account.isOutlook()
? new HeaderTerm(MessageHelper.HEADER_CORRELATION_ID, message.msgid)
: new MessageIDTerm(message.msgid));
// Fallback
if (account.isOutlook())
if (imessages == null || imessages.length == 0)
try {
// Needed for Outlook
imessages = ifolder.search(
new AndTerm(
new SentDateTerm(ComparisonTerm.GE, new Date()),
new HeaderTerm(MessageHelper.HEADER_CORRELATION_ID, message.msgid)));
} catch (Throwable ex) {
Log.e(ex);
// Searching for random header:
// iCloud: NO [UNAVAILABLE] Unexpected exception
// Seznam: Jakarta Mail Exception: java.io.IOException: Connection dropped by server?
}
// Some email servers are slow with adding sent messages
if (retry)