1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 03:05:31 +00:00

Make sure folder is selected on uid fetch

This commit is contained in:
M66B 2019-10-21 09:54:20 +02:00
parent 6a237304a0
commit 81e822b5ab

View file

@ -42,6 +42,7 @@ import androidx.preference.PreferenceManager;
import com.sun.mail.iap.BadCommandException;
import com.sun.mail.iap.CommandFailedException;
import com.sun.mail.iap.ConnectionException;
import com.sun.mail.iap.ProtocolException;
import com.sun.mail.iap.Response;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
@ -1711,9 +1712,16 @@ class Core {
// This is done outside of JavaMail to prevent changed notifications
if (!ifolder.isOpen())
throw new FolderClosedException(ifolder, "UID FETCH");
MessagingException ex = (MessagingException) ifolder.doCommand(new IMAPFolder.ProtocolCommand() {
@Override
public Object doCommand(IMAPProtocol protocol) {
try {
protocol.select(folder.name);
} catch (ProtocolException ex) {
return new MessagingException("UID FETCH", ex);
}
// Build ranges
List<Pair<Long, Long>> ranges = new ArrayList<>();
long first = -1;