summaryrefslogtreecommitdiff
path: root/lib/kolabaccount.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2013-10-21 07:29:06 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2013-10-21 07:29:06 (GMT)
commit1d537e4e66c39bff54a0b1bd3fdd0791af9e8e77 (patch)
treedb3e612cbfdac11594723f021b3e31e00902a7a8 /lib/kolabaccount.cpp
parent035b0d705957f431009be5706cd880ff536d6650 (diff)
downloadkolab-utils-1d537e4e66c39bff54a0b1bd3fdd0791af9e8e77.tar.gz
Support multiple source accounts.
This will allow to reuse i.e. the imap account for servers that require multiple protocols to access all data (google).
Diffstat (limited to 'lib/kolabaccount.cpp')
-rw-r--r--lib/kolabaccount.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/kolabaccount.cpp b/lib/kolabaccount.cpp
index 587d597..0148e12 100644
--- a/lib/kolabaccount.cpp
+++ b/lib/kolabaccount.cpp
@@ -94,6 +94,9 @@ void KolabAccount::setWipeTargetFolders(bool enable)
bool KolabAccount::init()
{
+ if (mDryRun) {
+ return false;
+ }
if (mSession) {
return false;
}
@@ -184,6 +187,8 @@ KJob* KolabAccount::appendObject(Object obj, const QString& folder)
Error() << "got empty message";
return 0;
}
+
+ Q_ASSERT(mSession);
KIMAP::AppendJob *job = new KIMAP::AppendJob( mSession );
job->setMailBox( folder );
job->setContent( message->encodedContent( true ) );
@@ -208,7 +213,9 @@ void KolabAccount::appendObjectSync(Object obj, const QString& folder)
void KolabAccount::logout()
{
- Q_ASSERT(mSession);
+ if (!mSession) {
+ return;
+ }
KIMAP::LogoutJob *logoutJob = new KIMAP::LogoutJob(mSession);
logoutJob->exec();
mSession->close();
@@ -353,6 +360,7 @@ void KolabAccount::setupFolders()
Debug() << "setup default folders";
return;
}
+ Q_ASSERT(mSession);
SetupKolabFoldersJob *setupJob = new SetupKolabFoldersJob(mCapabilities, QString(), mSession, this);
setupJob->setKolabFolders(QStringList() << KOLAB_FOLDER_TYPE_CONTACT << KOLAB_FOLDER_TYPE_EVENT << KOLAB_FOLDER_TYPE_TASK << KOLAB_FOLDER_TYPE_JOURNAL << KOLAB_FOLDER_TYPE_NOTE << KOLAB_FOLDER_TYPE_CONFIGURATION);
setupJob->exec();
@@ -375,6 +383,7 @@ void KolabAccount::setupFolders()
QList<Object> KolabAccount::getObjects(const QString& folder)
{
// Debug() << folder;
+ Q_ASSERT(mSession);
FetchMessagesJob *fetchJob = new FetchMessagesJob(folder, mSession, this);
fetchJob->exec();
Debug() << fetchJob->getMessages().size();
@@ -394,6 +403,7 @@ QStringList KolabAccount::lookupFolderList()
init();
mMailboxes.clear();
+ Q_ASSERT(mSession);
KIMAP::ListJob *listJob = new KIMAP::ListJob(mSession);
listJob->setOption(KIMAP::ListJob::IncludeUnsubscribed);
listJob->setQueriedNamespaces(mPersonalNamespaces);