1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-15 13:55:09 -05:00

Caldav: do not send fake inbox for public calendars to iCal

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@901 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-01-05 10:04:48 +00:00
parent 0ad8842ff0
commit e678cd1fc7

View File

@ -780,8 +780,8 @@ public class CaldavConnection extends AbstractConnection {
response.appendHrefProperty("C:schedule-outbox-URL", "/users/" + actualPrincipal + "/outbox"); response.appendHrefProperty("C:schedule-outbox-URL", "/users/" + actualPrincipal + "/outbox");
} }
} else { } else {
// public calendar, send root href as inbox url (always empty) // public calendar, send root href as inbox url (always empty) for Lightning
if (request.hasProperty("schedule-inbox-URL")) { if (request.isLightning() && request.hasProperty("schedule-inbox-URL")) {
response.appendHrefProperty("C:schedule-inbox-URL", "/"); response.appendHrefProperty("C:schedule-inbox-URL", "/");
} }
// send user outbox // send user outbox
@ -1240,9 +1240,17 @@ public class CaldavConnection extends AbstractConnection {
return getPathElement(getPathLength() - 1); return getPathElement(getPathLength() - 1);
} }
protected boolean isIcal() { protected boolean isIcal3() {
return isUserAgent("DAVKit/3");
}
protected boolean isLightning() {
return isUserAgent("Lightning/");
}
protected boolean isUserAgent(String key) {
String userAgent = headers.get("user-agent"); String userAgent = headers.get("user-agent");
return userAgent != null && userAgent.indexOf("DAVKit/3") >= 0; return userAgent != null && userAgent.indexOf(key) >= 0;
} }
public boolean isFreeBusy() { public boolean isFreeBusy() {
@ -1304,7 +1312,7 @@ public class CaldavConnection extends AbstractConnection {
if (hrefs == null) { if (hrefs == null) {
hrefs = new HashSet<String>(); hrefs = new HashSet<String>();
} }
if (isIcal()) { if (isIcal3()) {
hrefs.add(streamReader.getText()); hrefs.add(streamReader.getText());
} else { } else {
hrefs.add(URIUtil.decode(encodePlusSign(streamReader.getText()))); hrefs.add(URIUtil.decode(encodePlusSign(streamReader.getText())));