Open renamed target folder to update subscribed state

This commit is contained in:
M66B 2019-10-04 15:59:02 +02:00
parent 928918e288
commit 96dd840075
1 changed files with 15 additions and 3 deletions

View File

@ -1173,9 +1173,21 @@ class Core {
if (ifolder.exists()) { if (ifolder.exists()) {
// https://tools.ietf.org/html/rfc3501#section-6.3.9 // https://tools.ietf.org/html/rfc3501#section-6.3.9
boolean subscribed = ifolder.isSubscribed(); boolean subscribed = ifolder.isSubscribed();
ifolder.setSubscribed(false); if (subscribed)
ifolder.renameTo(istore.getFolder(folder.rename)); ifolder.setSubscribed(false);
ifolder.setSubscribed(subscribed);
Folder itarget = istore.getFolder(folder.rename);
ifolder.renameTo(itarget);
if (subscribed)
try {
itarget.open(READ_WRITE);
itarget.setSubscribed(subscribed);
itarget.close();
} catch (MessagingException ex) {
Log.e(ex);
}
db.folder().renameFolder(folder.account, folder.name, folder.rename); db.folder().renameFolder(folder.account, folder.name, folder.rename);
folder.name = folder.rename; folder.name = folder.rename;
} }