From 75328413c8b95be0a7792e5fb10d1902d94c61f9 Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 9 Feb 2011 20:57:42 +0000 Subject: [PATCH] Caldav: implement a new setting to disable task (VTODO) support: davmail.caldavDisableTasks and probably exclude most broken events git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1622 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../davmail/exchange/ExchangeSession.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 5b385232..2e6d5151 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -2484,9 +2484,18 @@ public abstract class ExchangeSession { dateCondition = gt("dtstart", formatSearchDate(cal.getTime())); } - return searchEvents(folderPath, or(isNull("instancetype"), + boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks"); + Condition condition; + if (caldavDisableTasks) { + condition = or(isEqualTo("instancetype", 1), + and(isEqualTo("instancetype", 0), dateCondition)); + } else { + condition = or(isNull("instancetype"), isEqualTo("instancetype", 1), - and(isEqualTo("instancetype", 0), dateCondition))); + and(isEqualTo("instancetype", 0), dateCondition)); + } + + return searchEvents(folderPath, condition); } protected Condition getRangeCondition(String timeRangeStart, String timeRangeEnd) throws IOException { @@ -2516,9 +2525,18 @@ public abstract class ExchangeSession { */ public List searchEvents(String folderPath, String timeRangeStart, String timeRangeEnd) throws IOException { Condition dateCondition = getRangeCondition(timeRangeStart, timeRangeEnd); - return searchEvents(folderPath, or(isNull("instancetype"), + boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks"); + Condition condition; + if (caldavDisableTasks) { + condition = or(isEqualTo("instancetype", 1), + and(isEqualTo("instancetype", 0), dateCondition)); + } else { + condition = or(isNull("instancetype"), isEqualTo("instancetype", 1), - and(isEqualTo("instancetype", 0), dateCondition))); + and(isEqualTo("instancetype", 0), dateCondition)); + } + + return searchEvents(folderPath, condition); } /**