diff options
Diffstat (limited to 'examples/maildirresource/maildirresource.cpp')
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 77ce11c..87623ca 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -271,10 +271,19 @@ KAsync::Job<void> MaildirResource::replay(Sink::Storage &synchronizationStore, c | |||
271 | } | 271 | } |
272 | const auto parentFolderPath = parentFolderRemoteId; | 272 | const auto parentFolderPath = parentFolderRemoteId; |
273 | KPIM::Maildir maildir(parentFolderPath, false); | 273 | KPIM::Maildir maildir(parentFolderPath, false); |
274 | if (!maildir.isValid(true)) { | ||
275 | return KAsync::error<void>(1, "Invalid folder " + parentFolderPath); | ||
276 | } | ||
274 | //FIXME assemble the MIME message | 277 | //FIXME assemble the MIME message |
278 | Trace() << "Creating a new mail."; | ||
275 | const auto remoteId = maildir.addEntry("foobar"); | 279 | const auto remoteId = maildir.addEntry("foobar"); |
276 | Trace() << "Creating a new mail: " << remoteId; | 280 | if (remoteId.isEmpty()) { |
277 | recordRemoteId(ENTITY_TYPE_MAIL, mail.identifier(), remoteId.toUtf8(), synchronizationTransaction); | 281 | Warning() << "Failed to create mail: " << remoteId; |
282 | return KAsync::error<void>(1, "Failed to create mail."); | ||
283 | } else { | ||
284 | Trace() << "Mail created: " << remoteId; | ||
285 | recordRemoteId(ENTITY_TYPE_MAIL, mail.identifier(), remoteId.toUtf8(), synchronizationTransaction); | ||
286 | } | ||
278 | } else if (operation == Sink::Operation_Removal) { | 287 | } else if (operation == Sink::Operation_Removal) { |
279 | const auto uid = Sink::Storage::uidFromKey(key); | 288 | const auto uid = Sink::Storage::uidFromKey(key); |
280 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, uid, synchronizationTransaction); | 289 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, uid, synchronizationTransaction); |