Commit a2bb3c49 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Be less strict when handling missing items during delete notifications

When handling a server-side notification about item removal it can
happen that the local item is already gone. In most cases this is the
result of the item actually having been deleted by us.

Even if this happened due to a sync failure between the server and
Akonadi, the item is now gone anyway from the server, so launching an
expensive full sync will not bring it back in any case.
parent 4b89f4e0
......@@ -355,20 +355,12 @@ void EwsFetchItemsJob::compareItemLists()
// In case of an incremental sync deleted items will be given explicitly. */
Q_FOREACH (const EwsId &id, mRemoteDeletedIds) {
QHash<QString, Item>::iterator it = itemHash.find(id.id());
/* If one or more items marked as deleted are not found it means that the folder is out
* of sync. The only way to fix this is to issue a full sync.
* The only exception is when an item is checked explicitly. In such case the absence
* of this item can be ignored. */
if (it == itemHash.end()) {
QHash<QString, QString>::iterator qit = mQueuedUpdates[EwsDeletedEvent].find(id.id());
if (EWSRES_LOG().isDebugEnabled() && qit != mQueuedUpdates[EwsDeletedEvent].end()) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Match for queued deletion of item %1").arg(ewsHash(id.id()));
}
if (!mItemsToCheck.contains(id) && qit == mQueuedUpdates[EwsDeletedEvent].end()) {
setErrorMsg(QStringLiteral("Got delete for item %1, but item not found in local store.").arg(ewsHash(id.id())));
emitResult();
return;
}
/* If an item is not found locally, it can mean two things:
* 1. The item got deleted earlier without the resource being told about it.
* 2. The item was never known by Akonadi due to a sync problem.
* Either way the item doesn't exist any more and there is no point crying about it. */
qCDebugNC(EWSRES_LOG) << QStringLiteral("Got delete for item %1, but item not found in local store.").arg(ewsHash(id.id()));
} else {
mDeletedItems.append(*it);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment