mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
Caldav: exclude private events on shared or public calendar PROPFIND
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@974 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b7421263e2
commit
37aa6db3f2
@ -2525,6 +2525,12 @@ public class ExchangeSession {
|
|||||||
dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n";
|
dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String privateCondition = "";
|
||||||
|
if (!isSharedFolder(folderPath)) {
|
||||||
|
LOGGER.debug("Shared or public calendar: exclude private events");
|
||||||
|
privateCondition = " AND \"http://schemas.microsoft.com/exchange/sensitivity\" = 0\n";
|
||||||
|
}
|
||||||
|
|
||||||
String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\", \"urn:schemas:calendar:instancetype\"" +
|
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 (" +
|
||||||
@ -2534,6 +2540,7 @@ public class ExchangeSession {
|
|||||||
" OR (\"urn:schemas:calendar:instancetype\" = 0\n" +
|
" OR (\"urn:schemas:calendar:instancetype\" = 0\n" +
|
||||||
dateCondition +
|
dateCondition +
|
||||||
" )) AND \"DAV:contentclass\" = 'urn:content-classes:appointment'\n" +
|
" )) AND \"DAV:contentclass\" = 'urn:content-classes:appointment'\n" +
|
||||||
|
privateCondition +
|
||||||
" ORDER BY \"urn:schemas:calendar:dtstart\" DESC\n";
|
" ORDER BY \"urn:schemas:calendar:dtstart\" DESC\n";
|
||||||
return getEvents(folderPath, searchQuery);
|
return getEvents(folderPath, searchQuery);
|
||||||
}
|
}
|
||||||
@ -2553,6 +2560,7 @@ public class ExchangeSession {
|
|||||||
for (MultiStatusResponse response : responses) {
|
for (MultiStatusResponse response : responses) {
|
||||||
String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype", Namespace.getNamespace("urn:schemas:calendar:"));
|
String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype", Namespace.getNamespace("urn:schemas:calendar:"));
|
||||||
Event event = buildEvent(response);
|
Event event = buildEvent(response);
|
||||||
|
//noinspection VariableNotUsedInsideIf
|
||||||
if (instancetype == null) {
|
if (instancetype == null) {
|
||||||
// check ics content
|
// check ics content
|
||||||
try {
|
try {
|
||||||
@ -2863,6 +2871,16 @@ public class ExchangeSession {
|
|||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if folderPath is inside user mailbox.
|
||||||
|
*
|
||||||
|
* @param folderPath absolute folder path
|
||||||
|
* @return true if folderPath is a public or shared folder
|
||||||
|
*/
|
||||||
|
public boolean isSharedFolder(String folderPath) {
|
||||||
|
return !folderPath.startsWith(mailPath);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build base path for cmd commands (galfind, gallookup).
|
* Build base path for cmd commands (galfind, gallookup).
|
||||||
* This does not work with freebusy, which requires /public/
|
* This does not work with freebusy, which requires /public/
|
||||||
|
Loading…
Reference in New Issue
Block a user