summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-10-05 16:12:48 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-10-05 16:12:48 (GMT)
commitcd1870fd0fd1019299af5c91626f341e6b8e89db (patch)
tree3bef7e7cd7744476bf694d9b448c6daf7ef3b548
parent1ae5db52a783bddf5acdd9ea98c6cc47cef8b9ef (diff)
downloadkolab-utils-cd1870fd0fd1019299af5c91626f341e6b8e89db.tar.gz
Avoid the "NO Mailbox is locked" problem as far as possible during mailbox creation.
-rw-r--r--migrationutility/kolabaccount.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/migrationutility/kolabaccount.cpp b/migrationutility/kolabaccount.cpp
index 99a2313..c55511f 100644
--- a/migrationutility/kolabaccount.cpp
+++ b/migrationutility/kolabaccount.cpp
@@ -215,7 +215,12 @@ void KolabAccount::cleanAccount()
Error() << deleteJob->errorString();
}
}
+ mFolders.clear();
mFolders.append(QLatin1String("inbox"));
+
+ //logging out and logging in again seems to help with the "NO Mailbox is locked" problem when creating folders afterwards.
+ logout();
+ init();
}
void KolabAccount::mailBoxesReceived(const QList<KIMAP::MailBoxDescriptor> &descriptors, const QList< QList< QByteArray > > &flags)
@@ -230,6 +235,12 @@ void KolabAccount::mailBoxesReceived(const QList<KIMAP::MailBoxDescriptor> &desc
#define KOLAB_FOLDER_TYPE_TRASH_SUFFIX ".wastebasket"
#define KOLAB_FOLDER_TYPE_JUNK_SUFFIX ".junkemail"
+
+/*
+ * This can fail with "NO Mailbox is locked" if the we deleted a selected folder before:
+ * http://lists.andrew.cmu.edu/pipermail/info-cyrus/2011-June/035049.html
+ *
+ */
void KolabAccount::createFolder(const QString &name, const QByteArray &annotation)
{
if (mFolders.contains(name, Qt::CaseInsensitive)) {
@@ -247,6 +258,7 @@ void KolabAccount::createFolder(const QString &name, const QByteArray &annotatio
Debug() << "created folder " << name;
if (createJob->error()) {
Error() << createJob->errorString();
+ return;
}
KIMAP::SetMetaDataJob *setMetadataJob = new KIMAP::SetMetaDataJob(mSession);
@@ -292,6 +304,7 @@ void KolabAccount::setupFolders()
selectJob->setMailBox(QString());
//TODO internationalize folder names
//TODO make part of setupkolabfoldersjob after adding types to folderTypeFromString in formathelpers.cpp
+ //TODO the suffixes should go in the private namespace
createFolder("Configuration", KOLAB_FOLDER_TYPE_CONFIGURATION KOLAB_FOLDER_TYPE_DEFAULT_SUFFIX);
createFolder("Drafts", KOLAB_FOLDER_TYPE_MAIL KOLAB_FOLDER_TYPE_DRAFTS_SUFFIX);
createFolder("Sent", KOLAB_FOLDER_TYPE_MAIL KOLAB_FOLDER_TYPE_SENT_SUFFIX);