1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Open read only folders

This commit is contained in:
M66B 2019-04-29 21:54:49 +02:00
parent 433a92f727
commit 6b74e15218

View file

@ -67,6 +67,7 @@ import javax.mail.Message;
import javax.mail.MessageRemovedException;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.ReadOnlyFolderException;
import javax.mail.Session;
import javax.mail.StoreClosedException;
import javax.mail.UIDFolder;
@ -665,8 +666,17 @@ public class ServiceSynchronize extends LifecycleService {
final IMAPFolder ifolder = (IMAPFolder) istore.getFolder(folder.name);
try {
ifolder.open(Folder.READ_WRITE);
} catch (ReadOnlyFolderException ex) {
try {
ifolder.open(Folder.READ_ONLY);
} catch (MessagingException ex1) {
Log.w(ex1);
db.folder().setFolderState(folder.id, null);
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex1, true));
continue;
}
} catch (MessagingException ex) {
// Including ReadOnlyFolderException
Log.w(ex);
db.folder().setFolderState(folder.id, null);
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex, true));
continue;