1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 17:31:52 -05:00

Caldav: Experimental, fix sub calendar folders path

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@711 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-10 08:06:15 +00:00
parent bdd5dbca78
commit 26f1194507

View File

@ -777,7 +777,7 @@ public class ExchangeSession {
* Search folders under given folder matching filter. * Search folders under given folder matching filter.
* *
* @param folderName Exchange folder name * @param folderName Exchange folder name
* @param filter search filter * @param filter search filter
* @param recursive deep search if true * @param recursive deep search if true
* @return list of folders * @return list of folders
* @throws IOException on error * @throws IOException on error
@ -2399,6 +2399,7 @@ public class ExchangeSession {
*/ */
public String buildCalendarPath(String principal, String folderName) throws IOException { public String buildCalendarPath(String principal, String folderName) throws IOException {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
// other user calendar => replace principal folder name in mailPath
if (principal != null && !alias.equals(principal) && !email.equals(principal)) { if (principal != null && !alias.equals(principal) && !email.equals(principal)) {
int index = mailPath.lastIndexOf('/', mailPath.length() - 2); int index = mailPath.lastIndexOf('/', mailPath.length() - 2);
if (index >= 0 && mailPath.endsWith("/")) { if (index >= 0 && mailPath.endsWith("/")) {
@ -2409,10 +2410,20 @@ public class ExchangeSession {
} else if (principal != null) { } else if (principal != null) {
buffer.append(mailPath); buffer.append(mailPath);
} }
if ("calendar".equals(folderName)) {
if (folderName != null && folderName.startsWith("calendar")) {
// replace 'calendar' folder name with i18n name
buffer.append(calendarUrl.substring(calendarUrl.lastIndexOf('/') + 1)); buffer.append(calendarUrl.substring(calendarUrl.lastIndexOf('/') + 1));
// sub calendar folder => append sub folder name
int index = folderName.indexOf('/');
if (index >= 0) {
buffer.append(folderName.substring(index));
}
// replace 'inbox' folder name with i18n name
} else if ("inbox".equals(folderName)) { } else if ("inbox".equals(folderName)) {
buffer.append(inboxUrl.substring(inboxUrl.lastIndexOf('/') + 1)); buffer.append(inboxUrl.substring(inboxUrl.lastIndexOf('/') + 1));
// append folder name without replace (public folder)
} else if (folderName != null && folderName.length() > 0) { } else if (folderName != null && folderName.length() > 0) {
buffer.append(folderName); buffer.append(folderName);
} }