Handle subscriptions

This commit is contained in:
M66B 2019-04-23 19:14:53 +02:00
parent 24c319cfcc
commit d3a761e729
1 changed files with 11 additions and 1 deletions

View File

@ -704,10 +704,12 @@ class Core {
Map<String, List<EntityFolder>> parentFolders = new HashMap<>();
for (Folder ifolder : ifolders) {
String fullName = ifolder.getFullName();
boolean subscribed = ifolder.isSubscribed();
String[] attr = attrs.get(ifolder);
String type = EntityFolder.getType(attr, fullName);
EntityLog.log(context, account.name + ":" + fullName +
" subscribed=" + subscribed +
" attrs=" + TextUtils.join(" ", attr) + " type=" + type);
if (type != null) {
@ -724,7 +726,7 @@ class Core {
folder.name = fullName;
folder.display = display;
folder.type = (EntityFolder.SYSTEM.equals(type) ? type : EntityFolder.USER);
folder.synchronize = false;
folder.synchronize = subscribed;
folder.poll = ("imap.gmail.com".equals(account.host));
folder.sync_days = EntityFolder.DEFAULT_SYNC;
folder.keep_days = EntityFolder.DEFAULT_KEEP;
@ -733,6 +735,14 @@ class Core {
} else {
Log.i(folder.name + " exists type=" + folder.type);
if (folder.synchronize && !subscribed)
try {
Log.i(folder.name + " subscribe=" + folder.synchronize);
ifolder.setSubscribed(folder.synchronize);
} catch (MessagingException ex) {
Log.w(ex);
}
if (folder.display == null) {
if (display != null) {
db.folder().setFolderDisplay(folder.id, display);