1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 03:32:22 -05:00

DAV: use search expression to request ishidden

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1107 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-06-28 16:26:08 +00:00
parent d586ffcd3f
commit c5ef2d1f15
2 changed files with 16 additions and 10 deletions

View File

@ -1010,7 +1010,7 @@ public class DavExchangeSession extends ExchangeSession {
FolderQueryTraversal mode = (!isPublic && recursive) ? FolderQueryTraversal.Deep : FolderQueryTraversal.Shallow;
List<Folder> folders = new ArrayList<Folder>();
MultiStatusResponse[] responses = searchItems(folderPath, FOLDER_PROPERTIES, and(isTrue("isfolder"), condition), mode);
MultiStatusResponse[] responses = searchItems(folderPath, FOLDER_PROPERTIES, and(isTrue("isfolder"), isFalse("ishidden"), condition), mode);
for (MultiStatusResponse response : responses) {
Folder folder = buildFolder(response);
@ -1135,7 +1135,7 @@ public class DavExchangeSession extends ExchangeSession {
@Override
public MessageList searchMessages(String folderPath, List<String> attributes, Condition condition) throws IOException {
MessageList messages = new MessageList();
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow);
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow);
for (MultiStatusResponse response : responses) {
Message message = buildMessage(response);
@ -1152,7 +1152,7 @@ public class DavExchangeSession extends ExchangeSession {
@Override
protected List<ExchangeSession.Contact> searchContacts(String folderPath, List<String> attributes, Condition condition) throws IOException {
List<ExchangeSession.Contact> contacts = new ArrayList<ExchangeSession.Contact>();
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow);
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow);
for (MultiStatusResponse response : responses) {
contacts.add(new Contact(response));
}
@ -1162,7 +1162,7 @@ public class DavExchangeSession extends ExchangeSession {
@Override
protected List<ExchangeSession.Event> searchEvents(String folderPath, List<String> attributes, Condition condition) throws IOException {
List<ExchangeSession.Event> events = new ArrayList<ExchangeSession.Event>();
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow);
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow);
for (MultiStatusResponse response : responses) {
String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype");
Event event = new Event(response);
@ -1195,10 +1195,9 @@ public class DavExchangeSession extends ExchangeSession {
searchRequest.append(',').append(Field.getRequestPropertyString(field.getAlias()));
}
}
searchRequest.append(" FROM SCOPE('").append(folderQueryTraversal).append(" TRAVERSAL OF \"").append(folderUrl).append("\"')")
.append(" WHERE \"DAV:ishidden\" = False");
searchRequest.append(" FROM SCOPE('").append(folderQueryTraversal).append(" TRAVERSAL OF \"").append(folderUrl).append("\"')");
if (condition != null) {
searchRequest.append(" AND ");
searchRequest.append(" WHERE ");
condition.appendTo(searchRequest);
}
// TODO order by ImapUid

View File

@ -225,6 +225,13 @@ public class Field {
createField(URN_SCHEMAS_HTTPMAIL, "textdescription"); // PR_BODY 0x1000 String
createField("im", DistinguishedPropertySetType.Address, 0x8062, "im"); // InstantMessagingAddress DistinguishedPropertySetType.Address/0x00008062/String
// OWA settings
createField("messageclass", 0x001a, PropertyType.String);
createField("roamingxmlstream", 0x7c08, PropertyType.Binary);
createField("roamingdictionary", 0x7c07, PropertyType.Binary);
createField(DAV, "ishidden");
}
protected static void createField(String alias, int propertyTag, PropertyType propertyType) {
@ -316,10 +323,10 @@ public class Field {
}
/**
* Get Mime header fieks.
* Get Mime header field.
*
* @param alias field alias
* @return field
* @param headerName header name
* @return field object
*/
public static Field getHeader(String headerName) {
return new Field(SCHEMAS_MAPI_STRING_INTERNET_HEADERS, headerName);