Optimize fetching subscribed folders

This commit is contained in:
M66B 2020-03-31 18:58:29 +02:00
parent 7608307a70
commit 12a9fa2272
1 changed files with 10 additions and 1 deletions

View File

@ -1280,6 +1280,15 @@ class Core {
long start = new Date().getTime();
Folder[] ifolders = defaultFolder.list("*");
List<String> subscription = new ArrayList<>();
try {
Folder[] isubscribed = defaultFolder.listSubscribed("*");
for (Folder ifolder : isubscribed)
subscription.add(ifolder.getFullName());
} catch (MessagingException ex) {
Log.e(account.name, ex);
}
long duration = new Date().getTime() - start;
Log.i("Remote folder count=" + ifolders.length +
@ -1292,7 +1301,7 @@ class Core {
String fullName = ifolder.getFullName();
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
String type = EntityFolder.getType(attrs, fullName, false);
boolean subscribed = ifolder.isSubscribed();
boolean subscribed = subscription.contains(fullName);
boolean selectable = true;
boolean inferiors = true;