Update folder selectable

pull/162/head
M66B 5 years ago
parent 56d8479b56
commit dc3399a742

@ -81,7 +81,6 @@ import java.util.Objects;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import javax.mail.Address; import javax.mail.Address;
import javax.mail.FetchProfile; import javax.mail.FetchProfile;
@ -1015,10 +1014,9 @@ class Core {
Map<String, List<EntityFolder>> parentFolders = new HashMap<>(); Map<String, List<EntityFolder>> parentFolders = new HashMap<>();
for (Folder ifolder : ifolders) { for (Folder ifolder : ifolders) {
String fullName = ifolder.getFullName(); String fullName = ifolder.getFullName();
String[] name = fullName.split(Pattern.quote(Character.toString(separator)));
boolean subscribed = subscription.contains(fullName);
String[] attr = ((IMAPFolder) ifolder).getAttributes(); String[] attr = ((IMAPFolder) ifolder).getAttributes();
String type = EntityFolder.getType(attr, fullName, false); String type = EntityFolder.getType(attr, fullName, false);
boolean subscribed = subscription.contains(fullName);
boolean selectable = !Arrays.asList(attr).contains("\\Noselect") && boolean selectable = !Arrays.asList(attr).contains("\\Noselect") &&
((ifolder.getType() & IMAPFolder.HOLDS_MESSAGES) != 0); ((ifolder.getType() & IMAPFolder.HOLDS_MESSAGES) != 0);
@ -1052,6 +1050,9 @@ class Core {
if (folder.subscribed == null || !folder.subscribed.equals(subscribed)) if (folder.subscribed == null || !folder.subscribed.equals(subscribed))
db.folder().setFolderSubscribed(folder.id, subscribed); db.folder().setFolderSubscribed(folder.id, subscribed);
if (folder.selectable != selectable)
db.folder().setFolderSelectable(folder.id, selectable);
// Compatibility // Compatibility
if (EntityFolder.USER.equals(folder.type) && EntityFolder.SYSTEM.equals(type)) if (EntityFolder.USER.equals(folder.type) && EntityFolder.SYSTEM.equals(type))
db.folder().setFolderType(folder.id, type); db.folder().setFolderType(folder.id, type);

@ -216,6 +216,9 @@ public interface DaoFolder {
@Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id") @Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id")
int setFolderSubscribed(long id, Boolean subscribed); int setFolderSubscribed(long id, Boolean subscribed);
@Query("UPDATE folder SET selectable = :selectable WHERE id = :id")
int setFolderSelectable(long id, Boolean selectable);
@Query("UPDATE folder SET type = :type WHERE id = :id") @Query("UPDATE folder SET type = :type WHERE id = :id")
int setFolderType(long id, String type); int setFolderType(long id, String type);

Loading…
Cancel
Save