mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +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.MessageRemovedException;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.NoSuchProviderException;
|
import javax.mail.NoSuchProviderException;
|
||||||
|
import javax.mail.ReadOnlyFolderException;
|
||||||
import javax.mail.Session;
|
import javax.mail.Session;
|
||||||
import javax.mail.StoreClosedException;
|
import javax.mail.StoreClosedException;
|
||||||
import javax.mail.UIDFolder;
|
import javax.mail.UIDFolder;
|
||||||
|
@ -665,8 +666,17 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
final IMAPFolder ifolder = (IMAPFolder) istore.getFolder(folder.name);
|
final IMAPFolder ifolder = (IMAPFolder) istore.getFolder(folder.name);
|
||||||
try {
|
try {
|
||||||
ifolder.open(Folder.READ_WRITE);
|
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) {
|
} catch (MessagingException ex) {
|
||||||
// Including ReadOnlyFolderException
|
Log.w(ex);
|
||||||
db.folder().setFolderState(folder.id, null);
|
db.folder().setFolderState(folder.id, null);
|
||||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex, true));
|
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex, true));
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue