mirror of https://github.com/M66B/FairEmail.git
Check delete flag on sync
This commit is contained in:
parent
a4e8f8fb3c
commit
0ff2c5a45d
|
@ -44,6 +44,7 @@ import com.sun.mail.iap.Response;
|
||||||
import com.sun.mail.imap.IMAPFolder;
|
import com.sun.mail.imap.IMAPFolder;
|
||||||
import com.sun.mail.imap.IMAPMessage;
|
import com.sun.mail.imap.IMAPMessage;
|
||||||
import com.sun.mail.imap.IMAPStore;
|
import com.sun.mail.imap.IMAPStore;
|
||||||
|
import com.sun.mail.imap.protocol.FLAGS;
|
||||||
import com.sun.mail.imap.protocol.FetchResponse;
|
import com.sun.mail.imap.protocol.FetchResponse;
|
||||||
import com.sun.mail.imap.protocol.IMAPProtocol;
|
import com.sun.mail.imap.protocol.IMAPProtocol;
|
||||||
import com.sun.mail.imap.protocol.UID;
|
import com.sun.mail.imap.protocol.UID;
|
||||||
|
@ -1115,6 +1116,7 @@ class Core {
|
||||||
|
|
||||||
for (int i = 0; i < imessages.length && state.isRunning() && state.isRecoverable(); i++)
|
for (int i = 0; i < imessages.length && state.isRunning() && state.isRecoverable(); i++)
|
||||||
try {
|
try {
|
||||||
|
if (!imessages[i].isSet(Flags.Flag.DELETED))
|
||||||
uids.remove(ifolder.getUID(imessages[i]));
|
uids.remove(ifolder.getUID(imessages[i]));
|
||||||
} catch (MessageRemovedException ex) {
|
} catch (MessageRemovedException ex) {
|
||||||
Log.w(folder.name, ex);
|
Log.w(folder.name, ex);
|
||||||
|
@ -1165,14 +1167,15 @@ class Core {
|
||||||
else
|
else
|
||||||
sb.append(range.first).append(':').append(range.second);
|
sb.append(range.first).append(':').append(range.second);
|
||||||
}
|
}
|
||||||
Response[] responses = protocol.command("UID FETCH " + sb + " (UID)", null);
|
Response[] responses = protocol.command("UID FETCH " + sb + " (UID FLAGS)", null);
|
||||||
|
|
||||||
if (responses.length > 0 && responses[responses.length - 1].isOK()) {
|
if (responses.length > 0 && responses[responses.length - 1].isOK()) {
|
||||||
for (Response response : responses)
|
for (Response response : responses)
|
||||||
if (response instanceof FetchResponse) {
|
if (response instanceof FetchResponse) {
|
||||||
FetchResponse fr = (FetchResponse) response;
|
FetchResponse fr = (FetchResponse) response;
|
||||||
UID uid = fr.getItem(UID.class);
|
UID uid = fr.getItem(UID.class);
|
||||||
if (uid != null)
|
FLAGS flags = fr.getItem(FLAGS.class);
|
||||||
|
if (uid != null && (flags == null || !flags.contains(Flags.Flag.DELETED)))
|
||||||
uids.remove(uid.uid);
|
uids.remove(uid.uid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue