mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Add displaynames to caldav responses
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@269 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
61f8839e81
commit
f8e7a25a1c
@ -274,6 +274,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
if (request.hasProperty("resourcetype")) {
|
||||
buffer.append(" <D:resourcetype/>");
|
||||
}
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>").append(eventPath).append("</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -302,6 +305,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
.append(base64Encode(session.getCalendarEtag()))
|
||||
.append("</CS:getctag>\n");
|
||||
}
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>").append(principal).append(" calendar</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -323,7 +329,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
if (request.hasProperty("getctag")) {
|
||||
buffer.append(" <CS:getctag xmlns:CS=\"http://calendarserver.org/ns/\">0</CS:getctag>\n");
|
||||
}
|
||||
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>inbox</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -345,21 +353,15 @@ public class CaldavConnection extends AbstractConnection {
|
||||
if (request.hasProperty("getctag")) {
|
||||
buffer.append(" <CS:getctag xmlns:CS=\"http://calendarserver.org/ns/\">0</CS:getctag>\n");
|
||||
}
|
||||
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>outbox</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
buffer.append(" </D:response>\n");
|
||||
}
|
||||
|
||||
public void sendErr(int status, Exception e) throws IOException {
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = e.toString();
|
||||
}
|
||||
sendErr(status, message);
|
||||
}
|
||||
|
||||
public void sendGetRoot() throws IOException {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("Connected to DavMail<br/>");
|
||||
@ -470,7 +472,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
buffer.append(" <D:collection/>\n");
|
||||
buffer.append(" </D:resourcetype>\n");
|
||||
}
|
||||
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>").append(principal).append("</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -497,7 +501,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
buffer.append(" <D:href>/principals/users/").append(session.getEmail()).append("</D:href>\n");
|
||||
buffer.append(" </D:principal-collection-set>");
|
||||
}
|
||||
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>ROOT</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -511,7 +517,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
buffer.append("<D:multistatus xmlns:D=\"DAV:\" xmlns:C=\"urn:ietf:params:xml:ns:caldav\">\n");
|
||||
buffer.append(" <D:response>\n");
|
||||
buffer.append(" <D:href>/principals/users/").append(principal).append("</D:href>\n");
|
||||
buffer.append(" <D:href>/principals/users/").append(principal).append("/</D:href>\n");
|
||||
buffer.append(" <D:propstat>\n");
|
||||
buffer.append(" <D:prop>\n");
|
||||
if (request.hasProperty("calendar-home-set")) {
|
||||
@ -528,16 +534,19 @@ public class CaldavConnection extends AbstractConnection {
|
||||
|
||||
if (request.hasProperty("schedule-inbox-URL")) {
|
||||
buffer.append(" <C:schedule-inbox-URL>\n");
|
||||
buffer.append(" <D:href>/users/").append(principal).append("/inbox</D:href>\n");
|
||||
buffer.append(" <D:href>/users/").append(principal).append("/inbox/</D:href>\n");
|
||||
buffer.append(" </C:schedule-inbox-URL>");
|
||||
}
|
||||
|
||||
if (request.hasProperty("schedule-outbox-URL")) {
|
||||
buffer.append(" <C:schedule-outbox-URL>\n");
|
||||
buffer.append(" <D:href>/users/").append(principal).append("/outbox</D:href>\n");
|
||||
buffer.append(" <D:href>/users/").append(principal).append("/outbox/</D:href>\n");
|
||||
buffer.append(" </C:schedule-outbox-URL>");
|
||||
}
|
||||
|
||||
if (request.hasProperty("displayname")) {
|
||||
buffer.append(" <D:displayname>").append(principal).append("</D:displayname>");
|
||||
}
|
||||
buffer.append(" </D:prop>\n");
|
||||
buffer.append(" <D:status>HTTP/1.1 200 OK</D:status>\n");
|
||||
buffer.append(" </D:propstat>\n");
|
||||
@ -618,6 +627,14 @@ public class CaldavConnection extends AbstractConnection {
|
||||
sendHttpResponse(HttpStatus.SC_MOVED_PERMANENTLY, responseHeaders, null, null, true);
|
||||
}
|
||||
|
||||
public void sendErr(int status, Exception e) throws IOException {
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = e.toString();
|
||||
}
|
||||
sendErr(status, message);
|
||||
}
|
||||
|
||||
public void sendErr(int status, String message) throws IOException {
|
||||
sendHttpResponse(status, null, "text/plain;charset=UTF-8", message, false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user