always rebuild local tracking status during slow and refresh syncs

git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@499 15ad00c4-1369-45f4-8270-35d70d36bdcd
This commit is contained in:
Patrick Ohly 2008-02-03 11:23:30 +00:00
parent 1a21c06a2e
commit 918400b4b0
1 changed files with 19 additions and 1 deletions

View File

@ -33,6 +33,19 @@ void TrackingSyncSource::beginSyncThrow(bool needAll,
RevisionMap_t revisions;
listAllItems(revisions);
// slow sync or refresh-from-server/client: clear tracking node and
// recreate it based on current content of database
if (!needPartial) {
ArrayList uids;
ArrayList modTimes;
m_trackingNode->readProperties(&uids, &modTimes);
for (int i = 0; i < uids.size(); i++ ) {
const StringBuffer *uid = (StringBuffer *)uids[i];
m_deletedItems.addItem(uid->c_str());
m_trackingNode->removeProperty(uid->c_str());
}
}
for (RevisionMap_t::const_iterator it = revisions.begin();
it != revisions.end();
it++) {
@ -41,7 +54,6 @@ void TrackingSyncSource::beginSyncThrow(bool needAll,
if (deleteLocal) {
deleteItem(uid);
m_trackingNode->removeProperty(uid.c_str());
} else {
// always remember the item, need full list to find deleted items
m_allItems.addItem(uid);
@ -58,10 +70,16 @@ void TrackingSyncSource::beginSyncThrow(bool needAll,
m_trackingNode->setPropertyValue(uid.c_str(), revision.c_str());
}
}
} else {
// refresh-from-client: make sure that all items we are about
// to send to server are also in our tracking node (otherwise
// the next incremental sync will go wrong)
m_trackingNode->setPropertyValue(uid.c_str(), revision.c_str());
}
}
}
// clear information about all items that we recognized as deleted
if (needPartial) {
ArrayList uids;
ArrayList modTimes;