diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-19 15:48:09 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:50 +0200 |
commit | 67ec34a8df3a2c3fe5ffbfd74ef06ee8a52ed2bb (patch) | |
tree | dbce66c9e54549e3c7e6bc58a28c003a3601c339 /examples/maildirresource | |
parent | 21da1b751d0f55648a7c9dbe71a3cd3440a134f0 (diff) | |
download | sink-67ec34a8df3a2c3fe5ffbfd74ef06ee8a52ed2bb.tar.gz sink-67ec34a8df3a2c3fe5ffbfd74ef06ee8a52ed2bb.zip |
Fixed maildir message moving
Diffstat (limited to 'examples/maildirresource')
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 920bd28..e0462b7 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -90,20 +90,14 @@ public: | |||
90 | return mMaildirPath; | 90 | return mMaildirPath; |
91 | } | 91 | } |
92 | QString folderPath; | 92 | QString folderPath; |
93 | auto db = Sink::Storage::DataStore::mainDatabase(transaction, ENTITY_TYPE_FOLDER); | 93 | const auto folder = entityStore().readLatest<ApplicationDomain::Folder>(folderIdentifier); |
94 | db.findLatest(folderIdentifier, [&](const QByteArray &, const QByteArray &value) { | 94 | if (mMaildirPath.endsWith(folder.getName())) { |
95 | Sink::EntityBuffer buffer(value); | 95 | folderPath = mMaildirPath; |
96 | const Sink::Entity &entity = buffer.entity(); | 96 | } else { |
97 | const auto adaptor = Sink::AdaptorFactoryRegistry::instance().getFactory<Sink::ApplicationDomain::Folder>(PLUGIN_NAME)->createAdaptor(entity); | 97 | auto folderName = folder.getName(); |
98 | auto parentFolder = adaptor->getProperty("parent").toString(); | 98 | //FIXME handle non toplevel folders |
99 | if (mMaildirPath.endsWith(adaptor->getProperty("name").toString())) { | 99 | folderPath = mMaildirPath + "/" + folderName; |
100 | folderPath = mMaildirPath; | 100 | } |
101 | } else { | ||
102 | auto folderName = adaptor->getProperty("name").toString(); | ||
103 | //FIXME handle non toplevel folders | ||
104 | folderPath = mMaildirPath + "/" + folderName; | ||
105 | } | ||
106 | }); | ||
107 | return folderPath; | 101 | return folderPath; |
108 | } | 102 | } |
109 | 103 | ||