aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-12 15:15:34 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-12 15:15:34 (GMT)
commit254a636c748857732ec26ee53b774d3935b569e2 (patch)
treede418326fbe9e555649c47bad5e076db6e21bd78
parentdb0ab1e9d1bbaf7ac77fccb5ceac757e4024d75c (diff)
Monitor: update cache for MOVE operations
Fixes an issue when items would not be moved the first time on IMAP due having set wrong parent collection.
-rw-r--r--src/core/monitor_p.cpp75
1 files changed, 44 insertions, 31 deletions
diff --git a/src/core/monitor_p.cpp b/src/core/monitor_p.cpp
index 769f204..5f26c26 100644
--- a/src/core/monitor_p.cpp
+++ b/src/core/monitor_p.cpp
@@ -950,6 +950,8 @@ bool MonitorPrivate::emitItemsNotification(const Protocol::ItemChangeNotificatio
// of the item before it has been moved.
if (msg.operation() != Protocol::ItemChangeNotification::Move) {
it.setParentCollection(col);
+ } else {
+ it.setParentCollection(colDest);
}
}
}
@@ -1260,43 +1262,54 @@ void MonitorPrivate::invalidateCaches(const Protocol::ChangeNotification &msg)
// remove invalidates
// modify removes the cache entry, as we need to re-fetch
// And subscription modify the visibility of the collection by the collectionFetchScope.
- if (msg.isRemove()) {
- switch (msg.type()) {
- case Protocol::Command::CollectionChangeNotification: {
- const auto &colNtf = static_cast<const Protocol::CollectionChangeNotification&>(msg);
+ switch (msg.type()) {
+ case Protocol::Command::CollectionChangeNotification: {
+ const auto &colNtf = static_cast<const Protocol::CollectionChangeNotification&>(msg);
+ switch (colNtf.operation()) {
+ case Protocol::CollectionChangeNotification::Modify:
+ case Protocol::CollectionChangeNotification::Move:
+ case Protocol::CollectionChangeNotification::Subscribe:
+ collectionCache->update(colNtf.id(), mCollectionFetchScope);
+ break;
+ case Protocol::CollectionChangeNotification::Remove:
collectionCache->invalidate(colNtf.id());
- switch (colNtf.operation()) {
- case Protocol::CollectionChangeNotification::Modify:
- case Protocol::CollectionChangeNotification::Move:
- case Protocol::CollectionChangeNotification::Subscribe:
- collectionCache->update(colNtf.id(), mCollectionFetchScope);
- default:
- break;
- }
- } break;
- case Protocol::Command::ItemChangeNotification: {
- const auto &itemNtf = static_cast<const Protocol::ItemChangeNotification&>(msg);
+ break;
+ default:
+ break;
+ }
+ } break;
+ case Protocol::Command::ItemChangeNotification: {
+ const auto &itemNtf = static_cast<const Protocol::ItemChangeNotification&>(msg);
+ switch (itemNtf.operation()) {
+ case Protocol::ItemChangeNotification::Modify:
+ case Protocol::ItemChangeNotification::ModifyFlags:
+ case Protocol::ItemChangeNotification::ModifyTags:
+ case Protocol::ItemChangeNotification::ModifyRelations:
+ case Protocol::ItemChangeNotification::Move:
+ itemCache->update(itemNtf.uids(), mItemFetchScope);
+ break;
+ case Protocol::ItemChangeNotification::Remove:
itemCache->invalidate(itemNtf.uids());
- switch (itemNtf.operation()) {
- case Protocol::ItemChangeNotification::Modify:
- case Protocol::ItemChangeNotification::ModifyFlags:
- case Protocol::ItemChangeNotification::ModifyTags:
- case Protocol::ItemChangeNotification::ModifyRelations:
- itemCache->update(itemNtf.uids(), mItemFetchScope);
- default:
- break;
- }
- } break;
- case Protocol::Command::TagChangeNotification: {
- const auto &tagNtf = static_cast<const Protocol::TagChangeNotification&>(msg);
+ break;
+ default:
+ break;
+ }
+ } break;
+ case Protocol::Command::TagChangeNotification: {
+ const auto &tagNtf = static_cast<const Protocol::TagChangeNotification&>(msg);
+ switch (tagNtf.operation()) {
+ case Protocol::TagChangeNotification::Modify:
+ tagCache->update({ tagNtf.id() }, mTagFetchScope);
+ break;
+ case Protocol::TagChangeNotification::Remove:
tagCache->invalidate({ tagNtf.id() });
- if (tagNtf.operation() == Protocol::TagChangeNotification::Modify) {
- tagCache->update({ tagNtf.id() }, mTagFetchScope);
- }
- } break;
+ break;
default:
break;
}
+ } break;
+ default:
+ break;
}
}