summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2011-10-20 11:46:10 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2011-10-20 11:46:35 +0200
commit4a303e140e518a0b16530718a9c2f40f6f636428 (patch)
tree8fdd5dac61d27a86fc46ba9275f3bc454f5fd832
parent6cd467bc551fe94eada76cf77d4f4e1c20225081 (diff)
vCalendar 1.0: fixed recurring all-day event support
vCalendar 1.0 cannot represent all-day events. The workarounds for mapping iCalendar 2.0 all-day events into vCalendar 1.0 was incomplete, leading to effects like shifting EXDATEs and end times. Example below. The fix involves several changes: - EXDATE needs the same conversion="autodate" conversion, so that date-only values are sent as date-time when converting to vCalendar 1.0 - End date/time (RR_END) must be converted back to date-only, taking the local time zone into account to get correct results. - EXDATE was converted back to date-only, but without the conversion to the local time zone. That shifted the exception dates by one day. - This last conversion was done for recurring events unless they were hourly. In other words, it was done also for non-all-day events. This happens to work, although opinions vary whether an all-day EXDATE really is valid with a non-all-day DTSTART. The comments in bugzilla.moblin.org #3009 where this code was introduced mention a bug in Evolution/libical around DATE-TIME EXDATE. Whatever that problem was, it no longer occurs in Evolution 2.32 with libical from Debian Stable. Time to remove this workaround and only apply the conversion when really needed (all-day events). Example before this fix, from testing against Mobical (aka EverDroid), after adding new test cases: Client_Sync_eds_event_testItems.A.test.dat | Client_Sync_eds_event_testItems.B.test.dat only in left file < > only in right file ------------------------------------------------------------------------------- BEGIN:VCALENDAR BEGIN:VCALENDAR VERSION:2.0 VERSION:2.0 BEGIN:VEVENT BEGIN:VEVENT SUMMARY:all-day recurrence\, daily\ SUMMARY:all-day recurrence\, daily\ , with exceptions , with exceptions DESCRIPTION:recurrs seven times\, e DESCRIPTION:recurrs seven times\, e xcluding (but counting) Friday and xcluding (but counting) Friday and Saturday Saturday DTEND;VALUE=DATE:20060407 | DTEND:20060406T215959Z DTSTART;VALUE=DATE:20060406 | DTSTART:20060405T220000Z > EXDATE:20060406 EXDATE:20060407 EXDATE:20060407 EXDATE:20060408 | RRULE:FREQ=DAILY;UNTIL=20060412T215 RRULE:FREQ=DAILY;UNTIL=20060412 | 959Z END:VEVENT END:VEVENT END:VCALENDAR END:VCALENDAR ------------------------------------------------------------------------------- BEGIN:VCALENDAR BEGIN:VCALENDAR VERSION:2.0 VERSION:2.0 BEGIN:VEVENT BEGIN:VEVENT SUMMARY:recurrence\, daily\, with e SUMMARY:recurrence\, daily\, with e xceptions xceptions DESCRIPTION:recurrs seven times\, e DESCRIPTION:recurrs seven times\, e xcluding (but counting) Friday and xcluding (but counting) Friday and Saturday Saturday DTEND:20060406T190000Z DTEND:20060406T190000Z DTSTART:20060406T183000Z DTSTART:20060406T183000Z EXDATE:20060407T183000Z | EXDATE:20060407 EXDATE:20060408T183000Z | EXDATE:20060408 RRULE:FREQ=DAILY;UNTIL=20060412T183 RRULE:FREQ=DAILY;UNTIL=20060412T183 000Z 000Z END:VEVENT END:VEVENT END:VCALENDAR END:VCALENDAR -------------------------------------------------------------------------------
-rw-r--r--src/syncevo/configs/datatypes/11calendar-profile.xml2
-rw-r--r--src/syncevo/configs/scripting/11calendar.xml10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/syncevo/configs/datatypes/11calendar-profile.xml b/src/syncevo/configs/datatypes/11calendar-profile.xml
index b4a95f0d..4236bb77 100644
--- a/src/syncevo/configs/datatypes/11calendar-profile.xml
+++ b/src/syncevo/configs/datatypes/11calendar-profile.xml
@@ -390,7 +390,7 @@
</property>
<property name="EXDATE" values="list" suppressempty="yes" onlyformode="old" delayedparsing="1" valueseparator=";" altvalueseparator=",">
- <value field="EXDATES"/>
+ <value field="EXDATES" conversion="autodate"/>
<position field="EXDATES" repeat="array" increment="1" minshow="0"/>
</property>
diff --git a/src/syncevo/configs/scripting/11calendar.xml b/src/syncevo/configs/scripting/11calendar.xml
index c2ea003c..069296e9 100644
--- a/src/syncevo/configs/scripting/11calendar.xml
+++ b/src/syncevo/configs/scripting/11calendar.xml
@@ -24,6 +24,9 @@
// - convert start to user zone (or floating) so it represents midnight
DTSTART = CONVERTTOUSERZONE(DTSTART);
MAKEALLDAY(DTSTART,DTEND,i);
+ if (RR_END != EMPTY) {
+ RR_END = DATEONLY(CONVERTTOUSERZONE(RR_END));
+ }
}
else {
// iCalendar 2.0 - only if DTSTART is a date-only value this really is an allday
@@ -52,14 +55,15 @@
i=i+1;
}
}
- // If vcalendar1.0, rrule is not secondly, minutely, or hourly, we strip time information
- // and only reserve date information
- if (ITEMDATATYPE()=="vCalendar10" && RR_FREQ!="h" && RR_FREQ!="m" && RR_FREQ!="s") {
+ // vCalendar1.0 has no VALUE=DATE EXDATEs, so convert back to that if
+ // the event is all-day.
+ if (ITEMDATATYPE()=="vCalendar10" && ISDATEONLY(DTSTART)) {
timestamp exdate;
i = 0;
while (i<SIZE(EXDATES)) {
exdate = EXDATES[i];
if (!ISDATEONLY(exdate)) {
+ exdate = CONVERTTOUSERZONE(exdate);
EXDATES[i] = DATEONLY(exdate);
}
i=i+1;