diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-16 00:26:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-16 00:26:44 +0200 |
commit | 86c75f9d7747353045aae9b141da3f8fb08583f9 (patch) | |
tree | 38e48bd3a951138e8475d335fe4da23ad6c07919 /common | |
parent | a894efcaced8b1e2e330c13d4e8f2d07d3ae814b (diff) | |
download | sink-86c75f9d7747353045aae9b141da3f8fb08583f9.tar.gz sink-86c75f9d7747353045aae9b141da3f8fb08583f9.zip |
Filter resources for syncing by type.
Otherwise we end up sending sync requests for contacts to imap
resources.
Diffstat (limited to 'common')
-rw-r--r-- | common/store.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/store.cpp b/common/store.cpp index 4735113..29e826a 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -311,9 +311,14 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query) | |||
311 | 311 | ||
312 | KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope) | 312 | KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope) |
313 | { | 313 | { |
314 | auto resourceFilter = scope.getResourceFilter(); | ||
315 | //Filter resources by type by default | ||
316 | if (!resourceFilter.propertyFilter.contains(ApplicationDomain::SinkResource::Capabilities::name) && !scope.type().isEmpty()) { | ||
317 | resourceFilter.propertyFilter.insert(ApplicationDomain::SinkResource::Capabilities::name, Query::Comparator{scope.type(), Query::Comparator::Contains}); | ||
318 | } | ||
314 | Sink::Query query; | 319 | Sink::Query query; |
315 | query.setFilter(scope.getResourceFilter()); | 320 | query.setFilter(resourceFilter); |
316 | SinkLog() << "Synchronizing: " << query; | 321 | SinkLog() << "Synchronizing all resource matching: " << query; |
317 | return fetchAll<ApplicationDomain::SinkResource>(query) | 322 | return fetchAll<ApplicationDomain::SinkResource>(query) |
318 | .template each([scope](const ApplicationDomain::SinkResource::Ptr &resource) -> KAsync::Job<void> { | 323 | .template each([scope](const ApplicationDomain::SinkResource::Ptr &resource) -> KAsync::Job<void> { |
319 | return synchronize(resource->identifier(), scope); | 324 | return synchronize(resource->identifier(), scope); |