On Sat, 2011-11-05 at 14:24 +0100, Ove Kåven wrote:
> Den 05. nov. 2011 13:27, skrev Ove Kåven:
> >> You can comment out the whole <parameter></parameter> part or remove it
> >> to try out whether it works.
> > 
> > I'll give it a shot, thanks...
> 
> Well, that works for the entries where SyncEvolution is adding EXDATEs
> itself, but for those EXDATEs which have already been pushed to Google
> and is coming back from Google with TZIDs, there's still a problem... I
> suppose it'll take a rule for the non-auto-generated EXDATEs too.

Attached two patches, both also committed to the maemo5-recurrences
branch.

The first one should suppress the TZID also for regular EXDATEs.

The second one attempts to add that time zone information back when
reading from the storage.

Both patches are completely untested.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From 755638e3c570b531c9bba81f99a8ac710cb25564 Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Sat, 5 Nov 2011 20:54:54 +0100
Subject: [PATCH 1/2] Maemo Calendar: avoid TZID in EXDATE property

This must be done for regular EXDATE values in the EXDATE array field
(new SIMPLE-EXDATE rule) and for the addition EXDATE values created
for RECURRENCE-IDs in the EXDATES_DETACHED array field (new
HAVE-EXDATE-DETACHED-NO-TZID rule).

Both these rules are activated as subrules by the new MAEMO-CALENDAR
rule, which is set by the Maemo Calendar backend now.

There is one caveat the SIMPLE-EXDATE rule is also active when parsing
an EXDATE created by the storage and therefore TZID will be ignored,
if any is set at all (uncertain).

A vCalendar outgoing script could fix this by adding the DTSTART time
zone to the floating time value in the parsed EXDATEs.
---
 src/backends/maemo/MaemoCalendarSource.cpp         |    2 +-
 .../configs/datatypes/11calendar-profile.xml       |   13 ++++++++++++-
 .../remoterules/00_have_exdate_detached.xml        |    1 +
 .../configs/remoterules/00_simple_exdate.xml       |    1 +
 .../configs/remoterules/10_maemo_calendar.xml      |    5 +++++
 5 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 src/syncevo/configs/remoterules/00_simple_exdate.xml
 create mode 100644 src/syncevo/configs/remoterules/10_maemo_calendar.xml

diff --git a/src/backends/maemo/MaemoCalendarSource.cpp b/src/backends/maemo/MaemoCalendarSource.cpp
index 7e7c788..8af695d 100644
--- a/src/backends/maemo/MaemoCalendarSource.cpp
+++ b/src/backends/maemo/MaemoCalendarSource.cpp
@@ -77,7 +77,7 @@ void MaemoCalendarSource::getSynthesisInfo(SynthesisInfo &info,
                                            XMLConfigFragments &fragments)
 {
     TrackingSyncSource::getSynthesisInfo(info, fragments);
-    info.m_backendRule = "HAVE-EXDATE-DETACHED";
+    info.m_backendRule = "MAEMO-CALENDAR";
 }
 
 void MaemoCalendarSource::open()
diff --git a/src/syncevo/configs/datatypes/11calendar-profile.xml b/src/syncevo/configs/datatypes/11calendar-profile.xml
index d9b66d1..b3ac504 100644
--- a/src/syncevo/configs/datatypes/11calendar-profile.xml
+++ b/src/syncevo/configs/datatypes/11calendar-profile.xml
@@ -378,7 +378,13 @@
                with the EXDATE:value1,value2 format (correct in iCalendar 2.0):
                as a workaround, accept all valid formats plus ; but
                generate separate properties with one value each. -->
-          <property name="EXDATE" values="expandedlist" suppressempty="yes" onlyformode="standard" delayedparsing="1" valueseparator="," altvalueseparator=";">
+          <!-- The simplified version of EXDATE is needed by the Maemo Calendar backend
+               because the calendar storage doesn't parse EXDATE;TZID=...: -->
+          <property name="EXDATE" values="expandedlist" suppressempty="yes" onlyformode="standard" delayedparsing="1" valueseparator="," altvalueseparator=";" rule="SIMPLE-EXDATE">
+            <value field="EXDATES"/>
+            <position field="EXDATES" repeat="array" increment="1" minshow="0"/>
+          </property>
+          <property name="EXDATE" values="expandedlist" suppressempty="yes" onlyformode="standard" delayedparsing="1" valueseparator="," altvalueseparator=";" rule="other">
             <value field="EXDATES"/>
             <position field="EXDATES" repeat="array" increment="1" minshow="0"/>
             <parameter name="TZID" default="no" show="yes">
@@ -411,6 +417,11 @@
             </parameter>
             <position field="EXDATES_DETACHED" repeat="array" increment="1" minshow="0"/>
           </property>
+          <!-- encode as EXDATE without TZID when backend asks for it -->
+          <property name="EXDATE" show="no" rule="HAVE-EXDATE-DETACHED-NO-TZID" mandatory="no">
+            <value field="EXDATES_DETACHED"/>
+            <position field="EXDATES_DETACHED" repeat="array" increment="1" minshow="0"/>
+          </property>
 
           <property name="DTEND" suppressempty="yes" delayedparsing="1">
             <value field="DTEND" conversion="autoenddate"/>
diff --git a/src/syncevo/configs/remoterules/00_have_exdate_detached.xml b/src/syncevo/configs/remoterules/00_have_exdate_detached.xml
index 5de60f7..650c3e0 100644
--- a/src/syncevo/configs/remoterules/00_have_exdate_detached.xml
+++ b/src/syncevo/configs/remoterules/00_have_exdate_detached.xml
@@ -1 +1,2 @@
     <subrule name="HAVE-EXDATE-DETACHED"/>
+    <subrule name="HAVE-EXDATE-DETACHED-NO-TZID"/>
diff --git a/src/syncevo/configs/remoterules/00_simple_exdate.xml b/src/syncevo/configs/remoterules/00_simple_exdate.xml
new file mode 100644
index 0000000..4d7c9b9
--- /dev/null
+++ b/src/syncevo/configs/remoterules/00_simple_exdate.xml
@@ -0,0 +1 @@
+<subrule name="SIMPLE-EXDATE"></subrule>
diff --git a/src/syncevo/configs/remoterules/10_maemo_calendar.xml b/src/syncevo/configs/remoterules/10_maemo_calendar.xml
new file mode 100644
index 0000000..3ec402a
--- /dev/null
+++ b/src/syncevo/configs/remoterules/10_maemo_calendar.xml
@@ -0,0 +1,5 @@
+    <remoterule name="MAEMO-CALENDAR">
+      <deviceid>none - this rule is activated via its name in MAKE/PARSETEXTWITHPROFILE() macro calls</deviceid>
+      <include rule="HAVE-EXDATE-DETACHED-NO-TZID"/>
+      <include rule="SIMPLE-EXDATE"/>
+    </remoterule>
-- 
1.7.2.5

>From 6d80112dc4959e8c4f940b026e0447fcf7256142 Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Sat, 5 Nov 2011 21:17:27 +0100
Subject: [PATCH 2/2] Maemo Calendar: fix EXDATEs after reading from storage

If the event has a DTSTART with TZID, then the EXDATE also should
have that same TZID. It is uncertain whether the backend provides
the TZID, but even if it does, because of the SIMPLE-EXDATE rule
the value wouldn't be parsed.
---
 src/backends/maemo/MaemoCalendarSource.cpp   |    1 +
 src/syncevo/configs/scripting/11calendar.xml |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/backends/maemo/MaemoCalendarSource.cpp b/src/backends/maemo/MaemoCalendarSource.cpp
index 8af695d..39a4682 100644
--- a/src/backends/maemo/MaemoCalendarSource.cpp
+++ b/src/backends/maemo/MaemoCalendarSource.cpp
@@ -78,6 +78,7 @@ void MaemoCalendarSource::getSynthesisInfo(SynthesisInfo &info,
 {
     TrackingSyncSource::getSynthesisInfo(info, fragments);
     info.m_backendRule = "MAEMO-CALENDAR";
+    info.m_afterReadScript += "$FIX_EXDATE_SCRIPT;\n";
 }
 
 void MaemoCalendarSource::open()
diff --git a/src/syncevo/configs/scripting/11calendar.xml b/src/syncevo/configs/scripting/11calendar.xml
index c2ea003..fe38eb6 100644
--- a/src/syncevo/configs/scripting/11calendar.xml
+++ b/src/syncevo/configs/scripting/11calendar.xml
@@ -188,6 +188,24 @@
       }
     ]]></macro>
 
+    <macro name="FIX_EXDATE_SCRIPT"><![CDATA[
+      // Add time zone information to EXDATEs: necessary for
+      // the Maemo calendar storages because it uses EXDATE
+      // without TZID.
+      if (!ISFLOATING(DTSTART)) {
+        STRING tz = TIMEZONE(DTSTART);
+        if (tz != "UTC") {
+          i = 0;
+          while (i<SIZE(EXDATES)) {
+            if (ISFLOATING(EXDATES[i])) {
+              SETTIMEZONE(EXDATES[i], tz);
+            }
+            i=i+1;
+          }
+        }
+      }
+    ]]></macro>
+
     <!-- Uses the UID/RECURRENCE-ID fields as the only criteria for
          comparing calendar data if the VCALENDAR_COMPARE_UID session
          variable is true, else does a normal comparison of the
-- 
1.7.2.5

_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to