engine: add DTSTAMP+LAST-MODIFIED before writing calendar items
When writing calendar items into a backend storage as iCalendar 2.0 or vCalendar 1.0, they should have DTSTAMP and LAST-MODIFIED values. DTSTAMP is expected by some CalDAV servers (like Apple). LAST-MODIFIED is usually added by the storage, but not always. In the text/plain -> syncevolution -> text/calendar -> Radicale -> EDS -> syncevolution chain the LAST-MODIFIED was not added by Radicale, which caused problems for change tracking in an EDS-based SyncEvolution.
This commit is contained in:
parent
3d299422f9
commit
266656d8bd
|
@ -661,7 +661,8 @@ void SyncSourceSerialize::getSynthesisInfo(SynthesisInfo &info,
|
|||
* to info.m_afterReadScript and info.m_beforeWriteScript.
|
||||
*/
|
||||
info.m_afterReadScript = "$VCALENDAR10_AFTERREAD_SCRIPT;\n";
|
||||
info.m_beforeWriteScript = "$VCALENDAR10_BEFOREWRITE_SCRIPT;\n";
|
||||
info.m_beforeWriteScript = "$VCALENDAR10_BEFOREWRITE_SCRIPT;\n"
|
||||
"$CALENDAR_BEFOREWRITE_SCRIPT;\n";
|
||||
} else if (type == "text/calendar" ||
|
||||
boost::starts_with(type, "text/calendar+")) {
|
||||
info.m_native = "iCalendar20";
|
||||
|
@ -670,6 +671,7 @@ void SyncSourceSerialize::getSynthesisInfo(SynthesisInfo &info,
|
|||
info.m_datatypes =
|
||||
" <use datatype='vCalendar10' mode='rw'/>\n"
|
||||
" <use datatype='iCalendar20' mode='rw' preferred='yes'/>\n";
|
||||
info.m_beforeWriteScript = "$CALENDAR_BEFOREWRITE_SCRIPT;\n";
|
||||
} else if (type == "text/plain") {
|
||||
info.m_fieldlist = "Note";
|
||||
info.m_profile = "\"Note\", 2";
|
||||
|
|
|
@ -255,3 +255,13 @@
|
|||
DESCRIPTION = SUBSTR(DESCRIPTION, lensummary + 1, lendescr - lensummary - 1);
|
||||
}
|
||||
]]></macro>
|
||||
|
||||
<macro name="CALENDAR_BEFOREWRITE_SCRIPT"><![CDATA[
|
||||
// set UTC time of generation for iCalendar 2.0 DTSTAMP
|
||||
DGENERATED = NOW();
|
||||
// ensure that there is a DMODIFIED = LAST-MODIFIED property,
|
||||
// not all storages add it
|
||||
if (!DMODIFIED) {
|
||||
DMODIFIED = DGENERATED;
|
||||
}
|
||||
]]></macro>
|
||||
|
|
Loading…
Reference in New Issue