Prevent folder add/delete loop

pull/146/head
M66B 6 years ago
parent 4831177e47
commit 02365af96b

@ -804,7 +804,7 @@ public class ServiceSynchronize extends LifecycleService {
public void folderRenamed(FolderEvent e) { public void folderRenamed(FolderEvent e) {
try { try {
wlAccount.acquire(); wlAccount.acquire();
Log.i(Helper.TAG, "Folder renamed=" + e.getFolder()); Log.i(Helper.TAG, "Folder renamed=" + e.getFolder().getFullName());
String old = e.getFolder().getFullName(); String old = e.getFolder().getFullName();
String name = e.getNewFolder().getFullName(); String name = e.getNewFolder().getFullName();
@ -822,6 +822,9 @@ public class ServiceSynchronize extends LifecycleService {
try { try {
wlAccount.acquire(); wlAccount.acquire();
Log.i(Helper.TAG, "Folder deleted=" + e.getFolder().getFullName()); Log.i(Helper.TAG, "Folder deleted=" + e.getFolder().getFullName());
EntityFolder folder = db.folder().getFolderByName(account.id, e.getFolder().getFullName());
if (folder != null)
db.folder().setFolderTbd(folder.id);
reload(ServiceSynchronize.this, "folder deleted"); reload(ServiceSynchronize.this, "folder deleted");
} finally { } finally {
wlAccount.release(); wlAccount.release();
@ -1800,7 +1803,8 @@ public class ServiceSynchronize extends LifecycleService {
names.add(folder.name); names.add(folder.name);
else { else {
IMAPFolder ifolder = (IMAPFolder) istore.getFolder(folder.name); IMAPFolder ifolder = (IMAPFolder) istore.getFolder(folder.name);
ifolder.delete(false); if (ifolder.exists())
ifolder.delete(false);
db.folder().deleteFolder(folder.id); db.folder().deleteFolder(folder.id);
} }
Log.i(Helper.TAG, "Local folder count=" + names.size()); Log.i(Helper.TAG, "Local folder count=" + names.size());

Loading…
Cancel
Save