1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-10 11:25:00 -05:00

Return etag instead of ctag

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@274 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-01-02 23:58:34 +00:00
parent b6956d5853
commit c781914354
2 changed files with 25 additions and 2 deletions

View File

@ -302,7 +302,7 @@ public class CaldavConnection extends AbstractConnection {
}
if (request.hasProperty("getetag")) {
buffer.append(" <D:getetag>")
.append(base64Encode(session.getCalendarCtag()))
.append(session.getCalendarEtag())
.append("</D:getetag>\n");
}
if (request.hasProperty("getctag")) {

View File

@ -1072,7 +1072,7 @@ public class ExchangeSession {
}
public String getCalendarCtag() throws IOException {
String etag = null;
String ctag = null;
Enumeration calendarEnum = wdr.propfindMethod(calendarUrl, 0);
if (!calendarEnum.hasMoreElements()) {
throw new IOException("Unable to get calendar object");
@ -1085,6 +1085,29 @@ public class ExchangeSession {
Property property = (Property) propertiesEnumeration.nextElement();
if ("http://schemas.microsoft.com/repl/".equals(property.getNamespaceURI())
&& "contenttag".equals(property.getLocalName())) {
ctag = property.getPropertyAsString();
}
}
}
if (ctag == null) {
throw new IOException("Unable to get calendar ctag");
}
return ctag;
}
public String getCalendarEtag() throws IOException {
String etag = null;
Enumeration calendarEnum = wdr.propfindMethod(calendarUrl, 0, EVENT_REQUEST_PROPERTIES);
if (!calendarEnum.hasMoreElements()) {
throw new IOException("Unable to get calendar object");
}
while (calendarEnum.hasMoreElements()) {
ResponseEntity calendarResponse = (ResponseEntity) calendarEnum.
nextElement();
Enumeration propertiesEnumeration = calendarResponse.getProperties();
while (propertiesEnumeration.hasMoreElements()) {
Property property = (Property) propertiesEnumeration.nextElement();
if ("getetag".equals(property.getLocalName())) {
etag = property.getPropertyAsString();
}
}