mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 03:32:22 -05:00
Caldav: implement a timezone translation table for iPhone 3, revert organizer patch (breaks notifications with Lightning)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@659 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
14084205bb
commit
c40e38d5f4
@ -1536,7 +1536,9 @@ public class ExchangeSession {
|
||||
// See https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-privateevents.txt
|
||||
boolean isAppleiCal = false;
|
||||
boolean hasOrganizer = false;
|
||||
boolean invalidTimezoneId = false;
|
||||
boolean hasAttendee = false;
|
||||
boolean hasCdoBusyStatus = false;
|
||||
String validTimezoneId = null;
|
||||
String eventClass = null;
|
||||
|
||||
List<AllDayState> allDayStates = new ArrayList<AllDayState>();
|
||||
@ -1566,8 +1568,16 @@ public class ExchangeSession {
|
||||
eventClass = value;
|
||||
} else if (key.startsWith("ORGANIZER")) {
|
||||
hasOrganizer = true;
|
||||
} else if (key.startsWith("DTSTART;TZID=\"")) {
|
||||
invalidTimezoneId = true;
|
||||
} else if (key.startsWith("ATTENDEE")) {
|
||||
hasAttendee = true;
|
||||
} else if (line.startsWith("TZID:(GMT")) {
|
||||
try {
|
||||
validTimezoneId = ResourceBundle.getBundle("timezones").getString(value);
|
||||
} catch (MissingResourceException mre) {
|
||||
LOGGER.warn(new BundleMessage("LOG_INVALID_TIMEZONE", value));
|
||||
}
|
||||
} else if (key.equals("X-MICROSOFT-CDO-BUSYSTATUS")) {
|
||||
hasCdoBusyStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1589,11 +1599,13 @@ public class ExchangeSession {
|
||||
continue;
|
||||
}
|
||||
// fix invalid exchange timezoneid
|
||||
if (invalidTimezoneId && line.indexOf(";TZID=\"") >= 0) {
|
||||
line = fixTimezoneId(line);
|
||||
if (validTimezoneId != null && line.indexOf(";TZID=\"") >= 0) {
|
||||
line = fixTimezoneId(line, validTimezoneId);
|
||||
}
|
||||
if (!fromServer && currentAllDayState.isAllDay && "X-MICROSOFT-CDO-ALLDAYEVENT:FALSE".equals(line)) {
|
||||
line = "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE";
|
||||
} else if (!fromServer && "END:VEVENT".equals(line) && !hasCdoBusyStatus) {
|
||||
result.writeLine("X-MICROSOFT-CDO-BUSYSTATUS:BUSY");
|
||||
} else if (!fromServer && "END:VEVENT".equals(line) && currentAllDayState.isAllDay && !currentAllDayState.hasCdoAllDay) {
|
||||
result.writeLine("X-MICROSOFT-CDO-ALLDAYEVENT:TRUE");
|
||||
} else if (!fromServer && !currentAllDayState.isAllDay && "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE".equals(line)) {
|
||||
@ -1602,8 +1614,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 (line.startsWith("TZID:") && validTimezoneId != null) {
|
||||
line = "TZID:" + validTimezoneId;
|
||||
} else if ("BEGIN:VEVENT".equals(line)) {
|
||||
currentAllDayState = allDayStates.get(count++);
|
||||
} else if (line.startsWith("X-CALENDARSERVER-ACCESS:")) {
|
||||
@ -1641,7 +1653,7 @@ public class ExchangeSession {
|
||||
}
|
||||
}
|
||||
// remove organizer line if user is organizer for iPhone
|
||||
} else if (fromServer && line.startsWith("ORGANIZER") && line.toLowerCase().endsWith(email)) {
|
||||
} else if (fromServer && line.startsWith("ORGANIZER") && !hasAttendee) {
|
||||
continue;
|
||||
// add organizer line to all events created in Exchange for active sync
|
||||
} else if (!fromServer && "END:VEVENT".equals(line) && !hasOrganizer) {
|
||||
@ -1656,13 +1668,13 @@ public class ExchangeSession {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
protected String fixTimezoneId(String line) {
|
||||
protected String fixTimezoneId(String line, String validTimezoneId) {
|
||||
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);
|
||||
int endIndex = line.indexOf('"', startIndex + 6);
|
||||
if (startIndex >= 0 && endIndex >= 0) {
|
||||
return line.substring(0, startIndex + 5) + validTimezoneId + line.substring(endIndex + 1);
|
||||
} else {
|
||||
return line;
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,7 @@ LOG_UNABLE_TO_SET_LOOK_AND_FEEL=Unable to set look and feel
|
||||
LOG_UNABLE_TO_SET_SYSTEM_LOOK_AND_FEEL=Unable to set system look and feel
|
||||
LOG_UNABLE_TO_STORE_SETTINGS=Unable to store settings:
|
||||
LOG_UNSUPORTED_REQUEST=Unsupported request: {0}
|
||||
LOG_INVALID_TIMEZONE=Invalid timezone: {0}
|
||||
UI_ABOUT=About...
|
||||
UI_ABOUT_DAVMAIL=About DavMail Gateway
|
||||
UI_ABOUT_DAVMAIL_AUTHOR=<html><b>DavMail Gateway</b><br>By Mickaël Guessant<br><br>
|
||||
|
@ -224,3 +224,4 @@ UI_CLIENT_CERTIFICATE=Certificat client
|
||||
UI_LOG_FILE_PATH=Chemin du fichier de traces :
|
||||
LOG_GATEWAY_INTERRUPTED=Arrêt de la passerelle DavMail en cours
|
||||
LOG_GATEWAY_STOP=Passerelle DavMail arrêtée
|
||||
LOG_INVALID_TIMEZONE=Fuseau horaire invalide : {0}
|
74
src/java/timezones.properties
Normal file
74
src/java/timezones.properties
Normal file
@ -0,0 +1,74 @@
|
||||
(GMT)\ Monrovia/Casablanca=Africa/Casablanca
|
||||
(GMT)\ Greenwich\ Mean\ Time/Dublin/Edinburgh/London=Europe/London
|
||||
(GMT+01.00)\ Berlin/Stockholm/Rome/Bern/Vienna=Europe/Berlin
|
||||
(GMT+01.00)\ Paris/Madrid/Brussels/Copenhagen=Europe/Paris
|
||||
(GMT+01.00)\ Prague/Central\ Europe=Europe/Prague
|
||||
(GMT+01.00)\ Sarajevo/Warsaw/Zagreb=Europe/Sarajevo
|
||||
(GMT+01.00)\ West\ Central\ Africa=Africa/Algiers
|
||||
(GMT+02.00)\ Athens/Istanbul/Minsk=Europe/Athens
|
||||
(GMT+02.00)\ Bucharest/Eastern\ Europe=Europe/Bucharest
|
||||
(GMT+02.00)\ Cairo=Africa/Cairo
|
||||
(GMT+02.00)\ Harare/Pretoria=Africa/Harare
|
||||
(GMT+02.00)\ Helsinki/Riga/Tallinn=Europe/Helsinki
|
||||
(GMT+02.00)\ Israel/Jerusalem\ Standard\ Time=Asia/Jerusalem
|
||||
(GMT+03.00)\ Baghdad=Asia/Baghdad
|
||||
(GMT+03.00)\ Arab/Kuwait/Riyadh=Asia/Kuwait
|
||||
(GMT+03.00)\ Moscow/St.\ Petersburg/Volgograd=Europe/Moscow
|
||||
(GMT+03.00)\ East\ Africa/Nairobi=Africa/Nairobi
|
||||
(GMT+03.30)\ Tehran=Asia/Tehran
|
||||
(GMT+04.00)\ Abu\ Dhabi/Muscat=Asia/Dubai
|
||||
(GMT+04.00)\ Caucasus/Baku/Tbilisi/Yerevan=Asia/Tbilisi
|
||||
(GMT+04.30)\ Kabul=Asia/Kabul
|
||||
(GMT+05.00)\ Ekaterinburg=Asia/Yekaterinburg
|
||||
(GMT+05.00)\ Islamabad/Karachi/Sverdlovsk/Tashkent=Asia/Tashkent
|
||||
(GMT+05.30)\ Calcutta/Chennai/Mumbai/New\ Delhi/India\ Standard\ Time=Asia/Kolkata
|
||||
(GMT+05.45)\ Kathmandu/Nepal=Asia/Katmandu
|
||||
(GMT+06.00)\ Almaty/North\ Central\ Asia/Novosibirsk=Asia/Almaty
|
||||
(GMT+06.00)\ Astana/Dhaka=Asia/Dhaka
|
||||
(GMT+06.00)\ Sri\ Jayawardenepura/Sri\ Lanka=Asia/Kolkata
|
||||
(GMT+06.30)\ Rangoon=Asia/Rangoon
|
||||
(GMT+07.00)\ Bangkok/Jakarta/Hanoi=Asia/Bangkok
|
||||
(GMT+07.00)\ Krasnoyarsk/North\ Asia=Asia/Krasnoyarsk
|
||||
(GMT+08.00)\ Beijing/Chongqing/Hong\ Kong/Urumqi=Asia/Hong_Kong
|
||||
(GMT+08.00)\ Irkutsk/Ulaan\ Bataar=Asia/Irkutsk
|
||||
(GMT+08.00)\ Kuala\ Lumpur/Singapore=Asia/Kuala_Lumpur
|
||||
(GMT+08.00)\ Perth/Western\ Australia=Australia/Perth
|
||||
(GMT+08.00)\ Taipei=Asia/Taipei
|
||||
(GMT+09.00)\ Tokyo/Osaka/Sapporo=Asia/Tokyo
|
||||
(GMT+09.00)\ Seoul/Korea\ Standard\ Time=Asia/Seoul
|
||||
(GMT+09.00)\ Yakutsk=Asia/Yakutsk
|
||||
(GMT+09.30)\ Adelaide/Central\ Australia=Australia/Adelaide
|
||||
(GMT+09.30)\ Darwin=Australia/Darwin
|
||||
(GMT+10.00)\ Brisbane/East\ Australia=Australia/Brisbane
|
||||
(GMT+10.00)\ Canberra/Melbourne/Sydney/Hobart\ (Year\ 2000\ only)=Australia/Melbourne
|
||||
(GMT+10.00)\ Guam/Port\ Moresby=Pacific/Guam
|
||||
(GMT+10.00)\ Hobart/Tasmania=Australia/Hobart
|
||||
(GMT+10.00)\ Vladivostok=Asia/Vladivostok
|
||||
(GMT+11.00)\ Magadan/Solomon\ Is./New\ Caledonia=Asia/Magadan
|
||||
(GMT+12.00)\ Wellington/Auckland=Pacific/Auckland
|
||||
(GMT+12.00)\ Fiji/Kamchatka/Marshall\ Is.=Pacific/Fiji
|
||||
(GMT+13.00)\ Tonga/Nuku'alofa=Pacific/Tongatapu
|
||||
(GMT-01.00)\ Azores=Atlantic/Azores
|
||||
(GMT-01.00)\ Cape\ Verde\ Is.=Atlantic/Cape_Verde
|
||||
(GMT-02.00)\ Mid-Atlantic=Atlantic/South_Georgia
|
||||
(GMT-03.00)\ Brasilia=America/Sao_Paulo
|
||||
(GMT-03.00)\ Buenos Aires/Georgetown=America/Argentina/Buenos_Aires
|
||||
(GMT-03.00)\ Greenland=America/Godthab
|
||||
(GMT-03.30)\ Newfoundland=America/St_Johns
|
||||
(GMT-04.00)\ Atlantic\ Time\ (Canada)=America/Halifax
|
||||
(GMT-04.00)\ Caracas/La\ Paz=America/Caracas
|
||||
(GMT-04.00)\ Santiago=America/Santiago
|
||||
(GMT-05.00)\ Bogota/Lima=America/Lima
|
||||
(GMT-05.00)\ Eastern\ Time\ (US\ &\ Canada)=America/New_York
|
||||
(GMT-05.00)\ Indiana\ (East)=America/Indiana/Knox
|
||||
(GMT-06.00)\ Central\ America=America/Chicago
|
||||
(GMT-06.00)\ Central\ Time\ (US\ &\ Canada)=America/Chicago
|
||||
(GMT-06.00)\ Mexico\ City/Tegucigalpa=America/Mexico_City
|
||||
(GMT-06.00)\ Saskatchewan=America/Regina
|
||||
(GMT-07.00)\ Arizona=America/Phoenix
|
||||
(GMT-07.00)\ Mountain\ Time\ (US\ &\ Canada)=America/Denver
|
||||
(GMT-08.00)\ Pacific\ Time\ (US\ &\ Canada)/Tijuana=America/Los_Angeles
|
||||
(GMT-09.00)\ Alaska=America/Anchorage
|
||||
(GMT-10.00)\ Hawaii=Pacific/Honolulu
|
||||
(GMT-11.00)\ Midway Island/Samoa=Pacific/Pago_Pago
|
||||
(GMT-12.00)\ Eniwetok/Kwajalein/Dateline Time=Pacific/Kwajalein
|
Loading…
Reference in New Issue
Block a user