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
1 changed files with 8 additions and 0 deletions

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;