1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 19:52:21 -05:00

Caldav: Exclude events with a null instancetype and no ICS content

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@891 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-12-21 13:01:49 +00:00
parent b8e3a2aafc
commit 67ed96545f

View File

@ -2027,7 +2027,7 @@ public class ExchangeSession {
} else if (line.startsWith("ACTION:")) { } else if (line.startsWith("ACTION:")) {
if (fromServer && "DISPLAY".equals(action) if (fromServer && "DISPLAY".equals(action)
// convert DISPLAY to AUDIO only if user defined an alarm sound // convert DISPLAY to AUDIO only if user defined an alarm sound
&& Settings.getProperty("davmail.caldavAlarmSound")!= null) { && Settings.getProperty("davmail.caldavAlarmSound") != null) {
// Convert alarm to audio for iCal // Convert alarm to audio for iCal
result.writeLine("ACTION:AUDIO"); result.writeLine("ACTION:AUDIO");
@ -2479,7 +2479,7 @@ public class ExchangeSession {
dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n"; dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n";
} }
String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\"" + String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\", \"urn:schemas:calendar:instancetype\"" +
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" + " FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
" WHERE (" + " WHERE (" +
// VTODO events have a null instancetype // VTODO events have a null instancetype
@ -2505,7 +2505,13 @@ public class ExchangeSession {
List<Event> events = new ArrayList<Event>(); List<Event> events = new ArrayList<Event>();
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executeSearchMethod(httpClient, URIUtil.encodePath(folderPath), searchQuery); MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executeSearchMethod(httpClient, URIUtil.encodePath(folderPath), searchQuery);
for (MultiStatusResponse response : responses) { for (MultiStatusResponse response : responses) {
events.add(buildEvent(response)); String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype", Namespace.getNamespace("urn:schemas:calendar:"));
Event event = buildEvent(response);
if (instancetype == null && event.getICS() == null) {
LOGGER.warn("Invalid event found at " + response.getHref());
} else {
events.add(event);
}
} }
return events; return events;
} }