1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Caldav: Fix missing TZID in DTSTART from iPhone

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1356 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-08-17 15:19:09 +00:00
parent 9353e2bc63
commit a4cd443485
3 changed files with 21 additions and 2 deletions

View File

@ -179,6 +179,9 @@ public class VCalendar extends VObject {
// convert date values to outlook compatible values
setServerAllday(vObject.getProperty("DTSTART"));
setServerAllday(vObject.getProperty("DTEND"));
} else {
fixTzid(vObject.getProperty("DTSTART"));
fixTzid(vObject.getProperty("DTEND"));
}
}
@ -190,6 +193,12 @@ public class VCalendar extends VObject {
}
private void fixTzid(VProperty property) {
if (property != null && !property.hasParam("TZID")) {
property.addParam("TZID", vTimezone.getPropertyValue("TZID"));
}
}
protected void splitExDate(VObject vObject) {
List<VProperty> exDateProperties = vObject.getProperties("EXDATE");
if (exDateProperties != null) {

View File

@ -149,8 +149,6 @@ public class TestCaldav extends AbstractDavMailTestCase {
MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
MultiStatusResponse[] responses = multiStatus.getResponses();
Set<String> ITEM_PROPERTIES = new HashSet<String>();
ITEM_PROPERTIES.add("instancetype");
List<ExchangeSession.Event> events = session.searchEvents("/users/" + session.getEmail() + "/calendar/",
session.and(
session.gt("dtstart", session.formatSearchDate(start)),

View File

@ -276,4 +276,16 @@ public class TestExchangeSessionEvent extends TestCase {
System.out.println("'"+BundleMessage.format(status)+"'");
}
public void testMissingTzid() throws IOException {
String itemBody = "BEGIN:VCALENDAR\n" +
"BEGIN:VEVENT\n" +
"DTSTART:20100101T000000\n" +
"DTEND:20100102T000000\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
String toServer = fixICS(itemBody, false);
System.out.println(toServer);
assertTrue(toServer.contains("DTSTART;TZID="));
assertTrue(toServer.contains("DTEND;TZID="));
}
}