diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-03 15:50:06 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-03 15:50:06 +0200 |
commit | 5c08ecda71cdbfd8951f9aab657cd2e2697ad0b3 (patch) | |
tree | 3178694224cd12b99111eddb1ba1b61d90ec8d60 /examples/imapresource/imapresource.cpp | |
parent | 77562cdae63e0ec7b09e8ece6af97165ba9e48dd (diff) | |
download | sink-5c08ecda71cdbfd8951f9aab657cd2e2697ad0b3.tar.gz sink-5c08ecda71cdbfd8951f9aab657cd2e2697ad0b3.zip |
Track modified properties to detect necessary replay changes
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 02713b3..b8129cd 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -328,7 +328,7 @@ public: | |||
328 | 328 | ||
329 | } | 329 | } |
330 | 330 | ||
331 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId) | 331 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE |
332 | { | 332 | { |
333 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); | 333 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); |
334 | auto login = imap->login(mUser, mPassword); | 334 | auto login = imap->login(mUser, mPassword); |
@@ -372,10 +372,8 @@ public: | |||
372 | auto uid = ridParts.takeLast().toLongLong(); | 372 | auto uid = ridParts.takeLast().toLongLong(); |
373 | //FIXME don't hardcode the separator | 373 | //FIXME don't hardcode the separator |
374 | auto mailbox = ridParts.join('.'); | 374 | auto mailbox = ridParts.join('.'); |
375 | Trace() << "Modifying a mail: " << oldRemoteId << " in the mailbox: " << mailbox; | 375 | Trace() << "Modifying a mail: " << oldRemoteId << " in the mailbox: " << mailbox << changedProperties; |
376 | //TODO if the message changed, remove old message and create a new one, | 376 | |
377 | //otherwise only change flags | ||
378 | |||
379 | QByteArrayList flags; | 377 | QByteArrayList flags; |
380 | if (!mail.getUnread()) { | 378 | if (!mail.getUnread()) { |
381 | flags << Imap::Flags::Seen; | 379 | flags << Imap::Flags::Seen; |
@@ -384,7 +382,7 @@ public: | |||
384 | flags << Imap::Flags::Flagged; | 382 | flags << Imap::Flags::Flagged; |
385 | } | 383 | } |
386 | 384 | ||
387 | bool messageChanged = false; | 385 | const bool messageChanged = changedProperties.contains(Sink::ApplicationDomain::Mail::MimeMessage::name); |
388 | if (messageChanged) { | 386 | if (messageChanged) { |
389 | QByteArray content = KMime::LFtoCRLF(mail.getMimeMessage()); | 387 | QByteArray content = KMime::LFtoCRLF(mail.getMimeMessage()); |
390 | QDateTime internalDate = mail.getDate(); | 388 | QDateTime internalDate = mail.getDate(); |
@@ -431,7 +429,7 @@ public: | |||
431 | return separator + folder.getName(); | 429 | return separator + folder.getName(); |
432 | } | 430 | } |
433 | 431 | ||
434 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Folder &folder, Sink::Operation operation, const QByteArray &oldRemoteId) | 432 | KAsync::Job<QByteArray> replay(const ApplicationDomain::Folder &folder, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE |
435 | { | 433 | { |
436 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); | 434 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); |
437 | auto login = imap->login(mUser, mPassword); | 435 | auto login = imap->login(mUser, mPassword); |