summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-04 17:33:32 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-04 17:33:32 +0200
commit4bc39b1b771aaf9ae5f7c96aeaddb06f2bd101ac (patch)
tree3637ce7983c3d1649766ddc12af36f3e879da40c /examples
parent447383e860d523ca3aab7da266622780f644de6c (diff)
downloadsink-4bc39b1b771aaf9ae5f7c96aeaddb06f2bd101ac.tar.gz
sink-4bc39b1b771aaf9ae5f7c96aeaddb06f2bd101ac.zip
Fixed folder sync
When explicitly listing the folder we can't rely on the subscription state, nor should we.
Diffstat (limited to 'examples')
-rw-r--r--examples/imapresource/imapresource.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index 5aa18dd..e7458f6 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -492,7 +492,7 @@ public:
492 //Otherwise fetch full payload for daterange 492 //Otherwise fetch full payload for daterange
493 auto folderList = QSharedPointer<QVector<Folder>>::create(); 493 auto folderList = QSharedPointer<QVector<Folder>>::create();
494 return imap->fetchFolders([folderList](const Folder &folder) { 494 return imap->fetchFolders([folderList](const Folder &folder) {
495 if (!folder.noselect) { 495 if (!folder.noselect && folder.subscribed) {
496 *folderList << folder; 496 *folderList << folder;
497 } 497 }
498 }) 498 })
@@ -580,14 +580,7 @@ public:
580 bool syncHeaders = query.hasFilter<ApplicationDomain::Mail::Folder>(); 580 bool syncHeaders = query.hasFilter<ApplicationDomain::Mail::Folder>();
581 //FIXME If we were able to to flush in between we could just query the local store for the folder list. 581 //FIXME If we were able to to flush in between we could just query the local store for the folder list.
582 return getFolderList(imap, query) 582 return getFolderList(imap, query)
583 .then([=] (const QVector<Folder> &folders) {
584 //Synchronize folders
585 return KAsync::value(folders)
586 .serialEach<void>([=](const Folder &folder) { 583 .serialEach<void>([=](const Folder &folder) {
587 //Skip unsubscribed folders
588 if (!folder.subscribed) {
589 return KAsync::null<void>();
590 }
591 SinkLog() << "Syncing folder " << folder.path(); 584 SinkLog() << "Syncing folder " << folder.path();
592 //Emit notification that the folder is being synced. 585 //Emit notification that the folder is being synced.
593 //The synchronizer can't do that because it has no concept of the folder filter on a mail sync scope meaning that the folder is being synchronized. 586 //The synchronizer can't do that because it has no concept of the folder filter on a mail sync scope meaning that the folder is being synchronized.
@@ -602,7 +595,6 @@ public:
602 SinkWarning() << "Failed to sync folder: " << folder.path() << "Error: " << error.errorMessage; 595 SinkWarning() << "Failed to sync folder: " << folder.path() << "Error: " << error.errorMessage;
603 }); 596 });
604 }); 597 });
605 });
606 } 598 }
607 }) 599 })
608 .then([=] (const KAsync::Error &error) { 600 .then([=] (const KAsync::Error &error) {