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:
parent
433a92f727
commit
6b74e15218
1 changed files with 11 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue