Caldav: no inbox/outbox for delegated calendars

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@495 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-04-01 23:29:05 +00:00
parent 4a22fd56d4
commit 44c4cba9fd
1 changed files with 24 additions and 27 deletions

View File

@ -446,7 +446,7 @@ public class CaldavConnection extends AbstractConnection {
String eventName = getEventFileNameFromPath(href); String eventName = getEventFileNameFromPath(href);
if (eventName == null) { if (eventName == null) {
notFound.add(href); notFound.add(href);
} else if ("inbox".equals(eventName)|| "calendar".equals(eventName)) { } else if ("inbox".equals(eventName) || "calendar".equals(eventName)) {
// Sunbird: just ignore // Sunbird: just ignore
} else { } else {
events.add(session.getEvent(principal, path, eventName)); events.add(session.getEvent(principal, path, eventName));
@ -524,24 +524,21 @@ public class CaldavConnection extends AbstractConnection {
actualPrincipal = session.getEmail(); actualPrincipal = session.getEmail();
} }
//if (!session.getEmail().equals(principal)) { CaldavResponse response = new CaldavResponse(HttpStatus.SC_MULTI_STATUS);
// String message = "Invalid principal path, try /principals/users/" + session.getEmail(); response.startMultistatus();
// DavGatewayTray.error(message); response.startResponse("/principals/users/" + principal);
// sendErr(HttpStatus.SC_NOT_FOUND, message); response.startPropstat();
//} else {
CaldavResponse response = new CaldavResponse(HttpStatus.SC_MULTI_STATUS);
response.startMultistatus();
response.startResponse("/principals/users/" + principal);
response.startPropstat();
if (request.hasProperty("calendar-home-set")) { if (request.hasProperty("calendar-home-set")) {
response.appendProperty("C:calendar-home-set", "<D:href>/users/" + actualPrincipal + "/calendar</D:href>"); response.appendProperty("C:calendar-home-set", "<D:href>/users/" + actualPrincipal + "/calendar</D:href>");
} }
if (request.hasProperty("calendar-user-address-set")) { if (request.hasProperty("calendar-user-address-set")) {
response.appendProperty("C:calendar-user-address-set", "<D:href>mailto:" + actualPrincipal + "</D:href>"); response.appendProperty("C:calendar-user-address-set", "<D:href>mailto:" + actualPrincipal + "</D:href>");
} }
// no inbox/outbox for delegated calendars
if (session.getEmail().equals(principal)) {
if (request.hasProperty("schedule-inbox-URL")) { if (request.hasProperty("schedule-inbox-URL")) {
response.appendProperty("C:schedule-inbox-URL", "<D:href>/users/" + actualPrincipal + "/inbox</D:href>"); response.appendProperty("C:schedule-inbox-URL", "<D:href>/users/" + actualPrincipal + "/inbox</D:href>");
} }
@ -549,18 +546,18 @@ public class CaldavConnection extends AbstractConnection {
if (request.hasProperty("schedule-outbox-URL")) { if (request.hasProperty("schedule-outbox-URL")) {
response.appendProperty("C:schedule-outbox-URL", "<D:href>/users/" + actualPrincipal + "/outbox</D:href>"); response.appendProperty("C:schedule-outbox-URL", "<D:href>/users/" + actualPrincipal + "/outbox</D:href>");
} }
}
if (request.hasProperty("displayname")) { if (request.hasProperty("displayname")) {
response.appendProperty("D:displayname", actualPrincipal); response.appendProperty("D:displayname", actualPrincipal);
} }
if (request.hasProperty("resourcetype")) { if (request.hasProperty("resourcetype")) {
response.appendProperty("D:resourcetype", "<D:collection/><D:principal/>"); response.appendProperty("D:resourcetype", "<D:collection/><D:principal/>");
} }
response.endPropStatOK(); response.endPropStatOK();
response.endResponse(); response.endResponse();
response.endMultistatus(); response.endMultistatus();
response.close(); response.close();
//}
} }
public void sendFreeBusy(String body) throws IOException { public void sendFreeBusy(String body) throws IOException {