diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-12 11:46:48 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-12 11:46:48 +0200 |
commit | a547334afca38baae64e0f5774b1eb7f082a08e3 (patch) | |
tree | 667ad75cb4aa1652c79f6ceab8422d0d9848113e /common/pipeline.cpp | |
parent | dc33cea58f4b920f60648e81379c58bd62861b9b (diff) | |
download | sink-a547334afca38baae64e0f5774b1eb7f082a08e3.tar.gz sink-a547334afca38baae64e0f5774b1eb7f082a08e3.zip |
Allow the preprocessor to move and use in mailtransport
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r-- | common/pipeline.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 91437d4..019784e 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp | |||
@@ -269,7 +269,26 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size) | |||
269 | } | 269 | } |
270 | 270 | ||
271 | foreach (const auto &processor, d->processors[bufferType]) { | 271 | foreach (const auto &processor, d->processors[bufferType]) { |
272 | processor->modifiedEntity(current, newEntity); | 272 | bool exitLoop = false; |
273 | const auto result = processor->processModification(Preprocessor::Modification, current, newEntity); | ||
274 | switch (result.action) { | ||
275 | case Preprocessor::MoveToResource: | ||
276 | isMove = true; | ||
277 | exitLoop = true; | ||
278 | break; | ||
279 | case Preprocessor::CopyToResource: | ||
280 | isMove = true; | ||
281 | exitLoop = true; | ||
282 | break; | ||
283 | case Preprocessor::DropModification: | ||
284 | SinkTraceCtx(d->logCtx) << "Dropping modification"; | ||
285 | return KAsync::error<qint64>(0); | ||
286 | default: | ||
287 | break; | ||
288 | } | ||
289 | if (exitLoop) { | ||
290 | break; | ||
291 | } | ||
273 | } | 292 | } |
274 | 293 | ||
275 | //The entity is either being copied or moved | 294 | //The entity is either being copied or moved |
@@ -378,6 +397,39 @@ void Preprocessor::finalizeBatch() | |||
378 | { | 397 | { |
379 | } | 398 | } |
380 | 399 | ||
400 | void Preprocessor::newEntity(ApplicationDomain::ApplicationDomainType &newEntity) | ||
401 | { | ||
402 | |||
403 | } | ||
404 | |||
405 | void Preprocessor::modifiedEntity(const ApplicationDomain::ApplicationDomainType &oldEntity, ApplicationDomain::ApplicationDomainType &newEntity) | ||
406 | { | ||
407 | |||
408 | } | ||
409 | |||
410 | void Preprocessor::deletedEntity(const ApplicationDomain::ApplicationDomainType &oldEntity) | ||
411 | { | ||
412 | |||
413 | } | ||
414 | |||
415 | Preprocessor::Result Preprocessor::processModification(Type type, const ApplicationDomain::ApplicationDomainType ¤t, ApplicationDomain::ApplicationDomainType &diff) | ||
416 | { | ||
417 | switch(type) { | ||
418 | case Creation: | ||
419 | newEntity(diff); | ||
420 | return {NoAction}; | ||
421 | case Modification: | ||
422 | modifiedEntity(current, diff); | ||
423 | return {NoAction}; | ||
424 | case Deletion: | ||
425 | deletedEntity(current); | ||
426 | return {NoAction}; | ||
427 | default: | ||
428 | break; | ||
429 | } | ||
430 | return {NoAction}; | ||
431 | } | ||
432 | |||
381 | QByteArray Preprocessor::resourceInstanceIdentifier() const | 433 | QByteArray Preprocessor::resourceInstanceIdentifier() const |
382 | { | 434 | { |
383 | return d->resourceInstanceIdentifier; | 435 | return d->resourceInstanceIdentifier; |