diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2011-09-13 10:58:49 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-09-14 15:07:30 +0200 |
commit | 8a640d2ae25fa8a0b9b4e2c104b3721bfe618899 (patch) | |
tree | f2cb3febb83aa8244ccfe4f3c94ecafb3a1b0352 /src/backends/evolution/EvolutionCalendarSource.cpp | |
parent | 5e88021226d53396b73da8496af5dfc4c50fdb5f (diff) |
SyncSource API: support and use Synthesis DB_DataMerged/Replace/Conflict result codes (BMC #22783)
Returning 207 = DB_DataMerged when an item replaced an existing one
wasn't correct (the data wasn't really merged) and also wasn't handled
as intended by the Synthesis engine. Now a backend can properly report what it did:
- data fully replaced
- data was merged
- data needs to be merged by engine
The last option is used by EDS and CalDAV when an add<->add conflict
is detected by the backends. In that case the Synthesis engine will
read the local item, merge it with the incoming item and write back
the result.
At the moment the tests assume that the more recent item wins
completely. But our field list config specifies a merge=lines mode for
some fields, which results in concatenating these fields in the merged
item. Thus the tests currently fail. Need to decide which behavior is
desired.
Diffstat (limited to 'src/backends/evolution/EvolutionCalendarSource.cpp')
-rw-r--r-- | src/backends/evolution/EvolutionCalendarSource.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp index ef28b74b..f8e7cc6b 100644 --- a/src/backends/evolution/EvolutionCalendarSource.cpp +++ b/src/backends/evolution/EvolutionCalendarSource.cpp @@ -274,7 +274,7 @@ void EvolutionCalendarSource::readItem(const string &luid, std::string &item, bo EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(const string &luid, const std::string &item, bool raw) { bool update = !luid.empty(); - bool merged = false; + InsertItemResultState state = ITEM_OKAY; bool detached = false; string newluid = luid; string data = item; @@ -390,7 +390,7 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co // which should never happen. newluid = id.getLUID(); if (m_allLUIDs.find(newluid) != m_allLUIDs.end()) { - merged = true; + state = ITEM_NEEDS_MERGE; } else { // if this is a detached recurrence, then we // must use e_cal_modify_object() below if @@ -438,7 +438,7 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co } } - if (update || merged || detached) { + if (update || state != ITEM_NEEDS_MERGE || detached) { ItemID id(newluid); bool isParent = id.m_rid.empty(); @@ -526,7 +526,7 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co modTime = getItemModTime(newid); } - return InsertItemResult(newluid, modTime, merged); + return InsertItemResult(newluid, modTime, state); } EvolutionCalendarSource::ICalComps_t EvolutionCalendarSource::removeEvents(const string &uid, bool returnOnlyChildren) |