Added workaround for folder list processing error

pull/214/head
M66B 10 months ago
parent e5f89e4d90
commit 8f84ccd178

@ -930,17 +930,26 @@ public class EmailService implements AutoCloseable {
List<EntityFolder> getFolders() throws MessagingException {
List<EntityFolder> folders = new ArrayList<>();
for (Folder ifolder : getStore().getDefaultFolder().list("*")) {
String fullName = ifolder.getFullName();
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
String type = EntityFolder.getType(attrs, fullName, true);
Log.i(fullName + " attrs=" + TextUtils.join(" ", attrs) + " type=" + type);
if (type != null)
folders.add(new EntityFolder(fullName, type));
}
try {
for (Folder ifolder : getStore().getDefaultFolder().list("*")) {
String fullName = ifolder.getFullName();
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
String type = EntityFolder.getType(attrs, fullName, true);
Log.i(fullName + " attrs=" + TextUtils.join(" ", attrs) + " type=" + type);
if (type != null)
folders.add(new EntityFolder(fullName, type));
}
EntityFolder.guessTypes(folders);
EntityFolder.guessTypes(folders);
} catch (MessagingException ex) {
if (ex.getMessage() != null &&
ex.getMessage().contains("LIST processing failed")) {
Log.w(ex);
folders.add(new EntityFolder("Inbox", EntityFolder.INBOX));
} else
throw ex;
}
return folders;
}

Loading…
Cancel
Save