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

Caldav: fix path translation to Exchange for calendars in sub folders under /calendar

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@749 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-24 08:58:22 +00:00
parent a4dbe3ddce
commit 3f742edce9

View File

@ -1131,6 +1131,15 @@ public class CaldavConnection extends AbstractConnection {
return "DELETE".equals(command);
}
/**
* Check if this request is a folder request.
*
* @return true if this is a folder (not event) request
*/
public boolean isFolder() {
return isPropFind() || isReport() || isPropPatch() || isOptions() || isPost();
}
public boolean isRoot() {
return (pathElements.length == 0 || pathElements.length == 1);
}
@ -1296,15 +1305,25 @@ public class CaldavConnection extends AbstractConnection {
* @throws IOException on error
*/
public String getExchangeFolderPath() throws IOException {
int endIndex;
if (isFolder()) {
endIndex = getPathLength();
} else {
endIndex = getPathLength() - 1;
}
if ("users".equals(getPathElement(1))) {
StringBuilder calendarPath = new StringBuilder();
calendarPath.append(getPathElement(3));
for (int i = 4; i < getPathLength() - 1; i++) {
for (int i = 4; i < endIndex; i++) {
calendarPath.append('/').append(getPathElement(i));
}
return session.buildCalendarPath(getPathElement(2), calendarPath.toString());
} else {
return path;
StringBuilder calendarPath = new StringBuilder();
for (int i=0;i<endIndex;i++) {
calendarPath.append('/').append(getPathElement(i));
}
return calendarPath.toString();
}
}