diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2010-05-10 13:51:26 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2010-05-17 12:19:04 +0200 |
commit | 2915fde0e7a661fa88836ce2c45a11083d0b26c9 (patch) | |
tree | 94e0311db7f9c8a8fd71880d48c8f64b0d867019 | |
parent | f8c3f9bb0ec47109c622089354a695329d6d4df3 (diff) |
Funambol, Memotoo: preserve meeting series when receiving update for detached recurrence (MBC #1916)mbc1916
The RECURRENCE-ID is not preserved by these servers and also was not
preserved by SyncEvolution or Synthesis, because the servers do not
send CtCap information. As a result, updating a detached recurrence (=
a single instance in a meeting series) overwrote series in Evolution
and only left the updated recurrence.
This patch fixes that problem by copying the original RECURRENCE-ID
property from the original event which is to be updated. This is only
done when necessary, because it has to read the original event.
-rw-r--r-- | src/backends/evolution/EvolutionCalendarSource.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp index 9dff32d9..5936cb31 100644 --- a/src/backends/evolution/EvolutionCalendarSource.cpp +++ b/src/backends/evolution/EvolutionCalendarSource.cpp @@ -429,9 +429,30 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co ItemID id(newluid); bool isParent = id.m_rid.empty(); - // ensure that the component has the right UID - if (update && !id.m_uid.empty()) { - icalcomponent_set_uid(subcomp, id.m_uid.c_str()); + // ensure that the component has the right UID and + // RECURRENCE-ID + if (update) { + if (!id.m_uid.empty()) { + icalcomponent_set_uid(subcomp, id.m_uid.c_str()); + } + if (!id.m_rid.empty()) { + // Reconstructing the RECURRENCE-ID is non-trivial, + // because our luid only contains the date-time, but + // not the time zone. Only do the work if the event + // really doesn't have a RECURRENCE-ID. + struct icaltimetype rid; + rid = icalcomponent_get_recurrenceid(subcomp); + if (icaltime_is_null_time(rid)) { + // Preserve the original RECURRENCE-ID, including + // timezone, no matter what the update contains + // (might have wrong timezone or UTC). + eptr<icalcomponent> orig(retrieveItem(id)); + icalproperty *orig_rid = icalcomponent_get_first_property(orig, ICAL_RECURRENCEID_PROPERTY); + if (orig_rid) { + icalcomponent_add_property(subcomp, icalproperty_new_clone(orig_rid)); + } + } + } } if (isParent) { |