|
@ -1239,17 +1239,23 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
|
|
|
|
|
|
for (Folder ifolder : ifolders) { |
|
|
for (Folder ifolder : ifolders) { |
|
|
String[] attrs = ((IMAPFolder) ifolder).getAttributes(); |
|
|
String[] attrs = ((IMAPFolder) ifolder).getAttributes(); |
|
|
|
|
|
boolean system = false; |
|
|
boolean selectable = true; |
|
|
boolean selectable = true; |
|
|
for (String attr : attrs) { |
|
|
for (String attr : attrs) { |
|
|
if ("\\Noselect".equals(attr)) { // TODO: is this attribute correct? |
|
|
if ("\\Noselect".equals(attr)) { // TODO: is this attribute correct? |
|
|
selectable = false; |
|
|
selectable = false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
if (attr.startsWith("\\")) |
|
|
|
|
|
if (EntityFolder.SYSTEM_FOLDER_ATTR.contains(attr.substring(1))) { |
|
|
|
|
|
selectable = false; |
|
|
|
|
|
|
|
|
if (attr.startsWith("\\")) { |
|
|
|
|
|
attr = attr.substring(1); |
|
|
|
|
|
if (EntityFolder.SYSTEM_FOLDER_ATTR.contains(attr)) { |
|
|
|
|
|
int index = EntityFolder.SYSTEM_FOLDER_ATTR.indexOf(attr); |
|
|
|
|
|
system = EntityFolder.SYSTEM.equals(EntityFolder.SYSTEM_FOLDER_TYPE.get(index)); |
|
|
|
|
|
if (!system) |
|
|
|
|
|
selectable = false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (selectable) { |
|
|
if (selectable) { |
|
@ -1259,13 +1265,16 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
folder = new EntityFolder(); |
|
|
folder = new EntityFolder(); |
|
|
folder.account = account.id; |
|
|
folder.account = account.id; |
|
|
folder.name = ifolder.getFullName(); |
|
|
folder.name = ifolder.getFullName(); |
|
|
folder.type = EntityFolder.USER; |
|
|
|
|
|
|
|
|
folder.type = (system ? EntityFolder.SYSTEM : EntityFolder.USER); |
|
|
folder.synchronize = false; |
|
|
folder.synchronize = false; |
|
|
folder.after = EntityFolder.DEFAULT_USER_SYNC; |
|
|
folder.after = EntityFolder.DEFAULT_USER_SYNC; |
|
|
db.folder().insertFolder(folder); |
|
|
db.folder().insertFolder(folder); |
|
|
Log.i(Helper.TAG, folder.name + " added"); |
|
|
Log.i(Helper.TAG, folder.name + " added"); |
|
|
} else |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
if (system) |
|
|
|
|
|
db.folder().setFolderType(folder.id, EntityFolder.SYSTEM); |
|
|
names.remove(folder.name); |
|
|
names.remove(folder.name); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|