diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 3 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 23 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 16 | ||||
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.cpp | 40 |
4 files changed, 13 insertions, 69 deletions
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index 46e67f3..f5ab2d9 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -126,13 +126,14 @@ class DummySynchronizer : public Sink::Synchronizer { | |||
126 | }); | 126 | }); |
127 | } | 127 | } |
128 | 128 | ||
129 | bool canReplay(const QByteArray &type, const QByteArray &key, const QByteArray &value) Q_DECL_OVERRIDE { return false; } | ||
130 | |||
129 | }; | 131 | }; |
130 | 132 | ||
131 | DummyResource::DummyResource(const Sink::ResourceContext &resourceContext, const QSharedPointer<Sink::Pipeline> &pipeline) | 133 | DummyResource::DummyResource(const Sink::ResourceContext &resourceContext, const QSharedPointer<Sink::Pipeline> &pipeline) |
132 | : Sink::GenericResource(resourceContext, pipeline) | 134 | : Sink::GenericResource(resourceContext, pipeline) |
133 | { | 135 | { |
134 | setupSynchronizer(QSharedPointer<DummySynchronizer>::create(resourceContext)); | 136 | setupSynchronizer(QSharedPointer<DummySynchronizer>::create(resourceContext)); |
135 | setupChangereplay(QSharedPointer<Sink::NullChangeReplay>::create(resourceContext)); | ||
136 | setupPreprocessors(ENTITY_TYPE_MAIL, | 137 | setupPreprocessors(ENTITY_TYPE_MAIL, |
137 | QVector<Sink::Preprocessor*>() << new MailPropertyExtractor); | 138 | QVector<Sink::Preprocessor*>() << new MailPropertyExtractor); |
138 | setupPreprocessors(ENTITY_TYPE_FOLDER, | 139 | setupPreprocessors(ENTITY_TYPE_FOLDER, |
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*>()); |
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index fc77315..fed18c4 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "libmaildir/maildir.h" | 28 | #include "libmaildir/maildir.h" |
29 | #include "inspection.h" | 29 | #include "inspection.h" |
30 | #include "synchronizer.h" | 30 | #include "synchronizer.h" |
31 | #include "sourcewriteback.h" | ||
32 | 31 | ||
33 | #include "facadefactory.h" | 32 | #include "facadefactory.h" |
34 | #include "adaptorfactoryregistry.h" | 33 | #include "adaptorfactoryregistry.h" |
@@ -383,18 +382,6 @@ public: | |||
383 | return job; | 382 | return job; |
384 | } | 383 | } |
385 | 384 | ||
386 | public: | ||
387 | QString mMaildirPath; | ||
388 | }; | ||
389 | |||
390 | class MaildirWriteback : public Sink::SourceWriteBack | ||
391 | { | ||
392 | public: | ||
393 | MaildirWriteback(const Sink::ResourceContext &resourceContext) : Sink::SourceWriteBack(resourceContext) | ||
394 | { | ||
395 | |||
396 | } | ||
397 | |||
398 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE | 385 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE |
399 | { | 386 | { |
400 | if (operation == Sink::Operation_Creation) { | 387 | if (operation == Sink::Operation_Creation) { |
@@ -453,9 +440,6 @@ MaildirResource::MaildirResource(const Sink::ResourceContext &resourceContext, c | |||
453 | auto synchronizer = QSharedPointer<MaildirSynchronizer>::create(resourceContext); | 440 | auto synchronizer = QSharedPointer<MaildirSynchronizer>::create(resourceContext); |
454 | synchronizer->mMaildirPath = mMaildirPath; | 441 | synchronizer->mMaildirPath = mMaildirPath; |
455 | setupSynchronizer(synchronizer); | 442 | setupSynchronizer(synchronizer); |
456 | auto changereplay = QSharedPointer<MaildirWriteback>::create(resourceContext); | ||
457 | changereplay->mMaildirPath = mMaildirPath; | ||
458 | setupChangereplay(changereplay); | ||
459 | 443 | ||
460 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MaildirMimeMessageMover(resourceContext.instanceId(), mMaildirPath) << new MaildirMailPropertyExtractor); | 444 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MaildirMimeMessageMover(resourceContext.instanceId(), mMaildirPath) << new MaildirMailPropertyExtractor); |
461 | setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath)); | 445 | setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath)); |
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 3fe551a..0688af6 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "resourceconfig.h" | 23 | #include "resourceconfig.h" |
24 | #include "definitions.h" | 24 | #include "definitions.h" |
25 | #include "domainadaptor.h" | 25 | #include "domainadaptor.h" |
26 | #include "sourcewriteback.h" | ||
27 | #include <QDir> | 26 | #include <QDir> |
28 | #include <QFileInfo> | 27 | #include <QFileInfo> |
29 | #include <QSettings> | 28 | #include <QSettings> |
@@ -45,30 +44,6 @@ SINK_DEBUG_AREA("mailtransportresource") | |||
45 | 44 | ||
46 | using namespace Sink; | 45 | using namespace Sink; |
47 | 46 | ||
48 | //TODO fold into synchronizer | ||
49 | class MailtransportWriteback : public Sink::SourceWriteBack | ||
50 | { | ||
51 | public: | ||
52 | MailtransportWriteback(const Sink::ResourceContext &resourceContext) : Sink::SourceWriteBack(resourceContext) | ||
53 | { | ||
54 | |||
55 | } | ||
56 | |||
57 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE | ||
58 | { | ||
59 | if (operation == Sink::Operation_Creation) { | ||
60 | SinkTrace() << "Dispatching message."; | ||
61 | // return send(mail, mSettings); | ||
62 | } else if (operation == Sink::Operation_Removal) { | ||
63 | } else if (operation == Sink::Operation_Modification) { | ||
64 | } | ||
65 | return KAsync::null<QByteArray>(); | ||
66 | } | ||
67 | |||
68 | public: | ||
69 | MailtransportResource::Settings mSettings; | ||
70 | }; | ||
71 | |||
72 | class MailtransportSynchronizer : public Sink::Synchronizer { | 47 | class MailtransportSynchronizer : public Sink::Synchronizer { |
73 | public: | 48 | public: |
74 | MailtransportSynchronizer(const Sink::ResourceContext &resourceContext) | 49 | MailtransportSynchronizer(const Sink::ResourceContext &resourceContext) |
@@ -134,6 +109,17 @@ public: | |||
134 | }); | 109 | }); |
135 | } | 110 | } |
136 | 111 | ||
112 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE | ||
113 | { | ||
114 | if (operation == Sink::Operation_Creation) { | ||
115 | SinkTrace() << "Dispatching message."; | ||
116 | // return send(mail, mSettings); | ||
117 | } else if (operation == Sink::Operation_Removal) { | ||
118 | } else if (operation == Sink::Operation_Modification) { | ||
119 | } | ||
120 | return KAsync::null<QByteArray>(); | ||
121 | } | ||
122 | |||
137 | public: | 123 | public: |
138 | QByteArray mResourceInstanceIdentifier; | 124 | QByteArray mResourceInstanceIdentifier; |
139 | MailtransportResource::Settings mSettings; | 125 | MailtransportResource::Settings mSettings; |
@@ -154,10 +140,6 @@ MailtransportResource::MailtransportResource(const Sink::ResourceContext &resour | |||
154 | synchronizer->mSettings = mSettings; | 140 | synchronizer->mSettings = mSettings; |
155 | setupSynchronizer(synchronizer); | 141 | setupSynchronizer(synchronizer); |
156 | 142 | ||
157 | auto changereplay = QSharedPointer<MailtransportWriteback>::create(resourceContext); | ||
158 | changereplay->mSettings = mSettings; | ||
159 | setupChangereplay(changereplay); | ||
160 | |||
161 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new MimeMessageMover << new MailPropertyExtractor); | 143 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new MimeMessageMover << new MailPropertyExtractor); |
162 | } | 144 | } |
163 | 145 | ||