summaryrefslogtreecommitdiffstats
path: root/examples/imapresource/imapresource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r--examples/imapresource/imapresource.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index e725872..0e766d5 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -63,18 +63,6 @@ public:
63 void updatedIndexedProperties(Sink::ApplicationDomain::BufferAdaptor &newEntity) 63 void updatedIndexedProperties(Sink::ApplicationDomain::BufferAdaptor &newEntity)
64 { 64 {
65 const auto mimeMessagePath = newEntity.getProperty("mimeMessage").toString(); 65 const auto mimeMessagePath = newEntity.getProperty("mimeMessage").toString();
66 // auto parts = mimeMessagePath.split('/');
67 // const auto key = parts.takeLast();
68 // const auto path = parts.join("/") + "/cur/";
69 //
70 // QDir dir(path);
71 // const QFileInfoList list = dir.entryInfoList(QStringList() << (key+"*"), QDir::Files);
72 // if (list.size() != 1) {
73 // Warning() << "Failed to find message " << path << key << list.size();
74 // return;
75 // }
76
77 // QString file;
78 QFile f(mimeMessagePath); 66 QFile f(mimeMessagePath);
79 if (!f.open(QIODevice::ReadOnly)) { 67 if (!f.open(QIODevice::ReadOnly)) {
80 Warning() << "Failed to open the file: " << mimeMessagePath; 68 Warning() << "Failed to open the file: " << mimeMessagePath;
@@ -91,7 +79,6 @@ public:
91 msg->parse(); 79 msg->parse();
92 80
93 newEntity.setProperty("subject", msg->subject(true)->asUnicodeString()); 81 newEntity.setProperty("subject", msg->subject(true)->asUnicodeString());
94 newEntity.setProperty("subject", msg->subject(true)->asUnicodeString());
95 newEntity.setProperty("sender", msg->from(true)->asUnicodeString()); 82 newEntity.setProperty("sender", msg->from(true)->asUnicodeString());
96 newEntity.setProperty("senderName", msg->from(true)->asUnicodeString()); 83 newEntity.setProperty("senderName", msg->from(true)->asUnicodeString());
97 newEntity.setProperty("date", msg->date(true)->dateTime()); 84 newEntity.setProperty("date", msg->date(true)->dateTime());
@@ -207,8 +194,6 @@ public:
207 194
208 Sink::ApplicationDomain::Mail mail; 195 Sink::ApplicationDomain::Mail mail;
209 mail.setFolder(folderLocalId); 196 mail.setFolder(folderLocalId);
210 //FIXME this should come from the mime message, extracted in the pipeline
211 mail.setExtractedSubject(message.msg->subject(true)->asUnicodeString());
212 197
213 auto filePath = Sink::resourceStorageLocation(mResourceInstanceIdentifier) + "/" + remoteId; 198 auto filePath = Sink::resourceStorageLocation(mResourceInstanceIdentifier) + "/" + remoteId;
214 QDir().mkpath(Sink::resourceStorageLocation(mResourceInstanceIdentifier) + "/" + path.toUtf8()); 199 QDir().mkpath(Sink::resourceStorageLocation(mResourceInstanceIdentifier) + "/" + path.toUtf8());
@@ -219,7 +204,6 @@ public:
219 const auto content = message.msg->encodedContent(); 204 const auto content = message.msg->encodedContent();
220 file.write(content); 205 file.write(content);
221 mail.setMimeMessagePath(filePath); 206 mail.setMimeMessagePath(filePath);
222 //FIXME Not sure if these are the actual flags
223 mail.setUnread(!message.flags.contains(Imap::Flags::Seen)); 207 mail.setUnread(!message.flags.contains(Imap::Flags::Seen));
224 mail.setImportant(message.flags.contains(Imap::Flags::Flagged)); 208 mail.setImportant(message.flags.contains(Imap::Flags::Flagged));
225 209
@@ -298,24 +282,6 @@ public:
298 } 282 }
299 283
300 for (const auto &folder : folderList) { 284 for (const auto &folder : folderList) {
301 // auto transaction = mainStore.createTransaction(Sink::Storage::ReadOnly);
302 // auto syncTransaction = synchronizationStore.createTransaction(Sink::Storage::ReadOnly);
303
304 //TODO load entity to read sync settings should we have some (if the folder is existing already)
305 //Note that this will not work if we change any of those settings in the pipeline
306 //
307 // auto mainDatabase = Sink::Storage::mainDatabase(transaction, ENTITY_TYPE_FOLDER);
308 // const auto sinkId = resolveRemoteId(ENTITY_TYPE_FOLDER, folder.toUtf8(), syncTransaction);
309 // const auto found = mainDatabase.contains(sinkId);
310 // if (found) {
311 // if (auto current = getLatest(mainDatabase, sinkId, mFolderAdaptorFactory)) {
312 //
313 // }
314 // }
315
316 // transaction.commit();
317 // syncTransaction.commit();
318
319 QSet<qint64> uids; 285 QSet<qint64> uids;
320 auto messagesFuture = imap.fetchMessages(folder, [this, folder, &uids](const QVector<Message> &messages) { 286 auto messagesFuture = imap.fetchMessages(folder, [this, folder, &uids](const QVector<Message> &messages) {
321 Trace() << "Synchronizing mails" << folder.normalizedPath(); 287 Trace() << "Synchronizing mails" << folder.normalizedPath();