mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 17:31:52 -05:00
Caldav: generic timezone patch for iPhone 3
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@657 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
16bb4a9a4b
commit
baaec39cac
@ -1537,6 +1537,7 @@ public class ExchangeSession {
|
||||
boolean isAppleiCal = false;
|
||||
boolean hasOrganizer = false;
|
||||
boolean hasAttendee = false;
|
||||
boolean invalidTimezoneId = false;
|
||||
String eventClass = null;
|
||||
|
||||
List<AllDayState> allDayStates = new ArrayList<AllDayState>();
|
||||
@ -1568,6 +1569,8 @@ public class ExchangeSession {
|
||||
hasAttendee = true;
|
||||
} else if (key.startsWith("ORGANIZER")) {
|
||||
hasOrganizer = true;
|
||||
} else if (key.startsWith("DTSTART;TZID=\"")) {
|
||||
invalidTimezoneId = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1587,7 +1590,12 @@ public class ExchangeSession {
|
||||
// remove empty properties
|
||||
if ("CLASS:".equals(line) || "LOCATION:".equals(line)) {
|
||||
continue;
|
||||
} else if (!fromServer && currentAllDayState.isAllDay && "X-MICROSOFT-CDO-ALLDAYEVENT:FALSE".equals(line)) {
|
||||
}
|
||||
// fix invalid exchange timezoneid
|
||||
if (invalidTimezoneId && line.indexOf(";TZID=\"") >= 0) {
|
||||
line = fixTimezoneId(line);
|
||||
}
|
||||
if (!fromServer && currentAllDayState.isAllDay && "X-MICROSOFT-CDO-ALLDAYEVENT:FALSE".equals(line)) {
|
||||
line = "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE";
|
||||
} else if (!fromServer && "END:VEVENT".equals(line) && currentAllDayState.isAllDay && !currentAllDayState.hasCdoAllDay) {
|
||||
result.writeLine("X-MICROSOFT-CDO-ALLDAYEVENT:TRUE");
|
||||
@ -1597,6 +1605,8 @@ public class ExchangeSession {
|
||||
line = getAllDayLine(line);
|
||||
} else if (fromServer && currentAllDayState.isCdoAllDay && line.startsWith("DTEND") && !line.startsWith("DTEND;VALUE=DATE")) {
|
||||
line = getAllDayLine(line);
|
||||
} else if (line.startsWith("TZID:") && invalidTimezoneId) {
|
||||
line = "TZID:TimezoneId";
|
||||
} else if ("BEGIN:VEVENT".equals(line)) {
|
||||
currentAllDayState = allDayStates.get(count++);
|
||||
} else if (line.startsWith("X-CALENDARSERVER-ACCESS:")) {
|
||||
@ -1649,6 +1659,16 @@ public class ExchangeSession {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
protected String fixTimezoneId(String line) {
|
||||
int startIndex = line.indexOf("TZID=\"");
|
||||
int endIndex = line.indexOf('"', startIndex+6);
|
||||
if (startIndex >= 0 && endIndex >=0) {
|
||||
return line.substring(0, startIndex+5)+"TimezoneId"+line.substring(endIndex+1);
|
||||
} else {
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
||||
protected void splitExDate(ICSBufferedWriter result, String line) {
|
||||
int cur = line.lastIndexOf(':') + 1;
|
||||
String start = line.substring(0, cur);
|
||||
|
Loading…
x
Reference in New Issue
Block a user