diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-21 23:13:38 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-21 23:51:24 +0100 |
commit | 1d713d9e2dbaf27de9da087f9270d260dfc40c31 (patch) | |
tree | 666d8edd42e44df3eaa674a35b6e938b99c2f4b4 /examples/imapresource/imapresource.cpp | |
parent | 0adba61a00491b96dadaa6d4719cb46831356222 (diff) | |
download | sink-1d713d9e2dbaf27de9da087f9270d260dfc40c31.tar.gz sink-1d713d9e2dbaf27de9da087f9270d260dfc40c31.zip |
Folded the SourceWriteback into the Synchronizer.
By concentrating all communication to the source in one place we get rid
of several oddities.
* Quite a bit of duplication since both need access to the
synchronizationStore and the source.
* We currently have an akward locking in place because both classes
access the ync store. This is not easier to resolve cleanly.
* The live of resource implementers becomes easier.
* An implementation could elect to not use changereplay and always do a
full sync... (maybe?)
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 2b9659e..8fc7702 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "definitions.h" | 28 | #include "definitions.h" |
29 | #include "inspection.h" | 29 | #include "inspection.h" |
30 | #include "synchronizer.h" | 30 | #include "synchronizer.h" |
31 | #include "sourcewriteback.h" | ||
32 | #include "remoteidmap.h" | 31 | #include "remoteidmap.h" |
33 | #include "query.h" | 32 | #include "query.h" |
34 | 33 | ||
@@ -393,22 +392,6 @@ public: | |||
393 | return KAsync::error<void>("Nothing to do"); | 392 | return KAsync::error<void>("Nothing to do"); |
394 | } | 393 | } |
395 | 394 | ||
396 | public: | ||
397 | QString mServer; | ||
398 | int mPort; | ||
399 | QString mUser; | ||
400 | QString mPassword; | ||
401 | QByteArray mResourceInstanceIdentifier; | ||
402 | }; | ||
403 | |||
404 | class ImapWriteback : public Sink::SourceWriteBack | ||
405 | { | ||
406 | public: | ||
407 | ImapWriteback(const ResourceContext &resourceContext) : Sink::SourceWriteBack(resourceContext) | ||
408 | { | ||
409 | |||
410 | } | ||
411 | |||
412 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE | 395 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE |
413 | { | 396 | { |
414 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); | 397 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); |
@@ -595,12 +578,6 @@ ImapResource::ImapResource(const ResourceContext &resourceContext, const QShared | |||
595 | synchronizer->mUser = mUser; | 578 | synchronizer->mUser = mUser; |
596 | synchronizer->mPassword = mPassword; | 579 | synchronizer->mPassword = mPassword; |
597 | setupSynchronizer(synchronizer); | 580 | setupSynchronizer(synchronizer); |
598 | auto changereplay = QSharedPointer<ImapWriteback>::create(resourceContext); | ||
599 | changereplay->mServer = mServer; | ||
600 | changereplay->mPort = mPort; | ||
601 | changereplay->mUser = mUser; | ||
602 | changereplay->mPassword = mPassword; | ||
603 | setupChangereplay(changereplay); | ||
604 | 581 | ||
605 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MimeMessageMover << new MailPropertyExtractor); | 582 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MimeMessageMover << new MailPropertyExtractor); |
606 | setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>()); | 583 | setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>()); |