IMAP: improve Exchange 2010 header search, use direct header names to implement substring search on some headers

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1987 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-08-05 12:34:12 +00:00
parent 0238281523
commit 43356e24ff
2 changed files with 11 additions and 11 deletions

View File

@ -863,12 +863,15 @@ public class EwsExchangeSession extends ExchangeSession {
@Override @Override
public Condition headerIsEqualTo(String headerName, String value) { public Condition headerIsEqualTo(String headerName, String value) {
if (serverVersion.startsWith("Exchange2010")) { if (serverVersion.startsWith("Exchange2010")) {
if ("message-id".equals(headerName)) { if ("message-id".equals(headerName)
|| "from".equals(headerName)
|| "to".equals(headerName)
|| "cc".equals(headerName)
|| "bcc".equals(headerName)) {
return new AttributeCondition(headerName, Operator.Contains, value, ContainmentMode.Substring, ContainmentComparison.IgnoreCase); return new AttributeCondition(headerName, Operator.Contains, value, ContainmentMode.Substring, ContainmentComparison.IgnoreCase);
} else { } else {
// Exchange 2010 does not support header search, use PR_TRANSPORT_MESSAGE_HEADERS instead // Exchange 2010 does not support header search, use PR_TRANSPORT_MESSAGE_HEADERS instead
return new AttributeCondition("messageheaders", Operator.Contains, headerName + ": " + value, ContainmentMode.Substring, ContainmentComparison.IgnoreCase); return new AttributeCondition("messageheaders", Operator.Contains, headerName + ": " + value, ContainmentMode.Substring, ContainmentComparison.IgnoreCase);
} }
} else { } else {
return new HeaderCondition(headerName, value); return new HeaderCondition(headerName, value);

View File

@ -73,16 +73,16 @@ public final class Field {
FIELD_MAP.put("iconIndex", new ExtendedFieldURI(0x1080, ExtendedFieldURI.PropertyType.Integer));// PR_ICON_INDEX FIELD_MAP.put("iconIndex", new ExtendedFieldURI(0x1080, ExtendedFieldURI.PropertyType.Integer));// PR_ICON_INDEX
FIELD_MAP.put("datereceived", new ExtendedFieldURI(0x0e06, ExtendedFieldURI.PropertyType.SystemTime));// PR_MESSAGE_DELIVERY_TIME FIELD_MAP.put("datereceived", new ExtendedFieldURI(0x0e06, ExtendedFieldURI.PropertyType.SystemTime));// PR_MESSAGE_DELIVERY_TIME
FIELD_MAP.put("bcc", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "bcc"));
FIELD_MAP.put("to", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "to")); FIELD_MAP.put("to", new UnindexedFieldURI("message:ToRecipients"));
FIELD_MAP.put("cc", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "cc")); FIELD_MAP.put("cc", new UnindexedFieldURI("message:CcRecipients"));
FIELD_MAP.put("from", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "from")); FIELD_MAP.put("from", new UnindexedFieldURI("message:From"));
FIELD_MAP.put("bcc", new UnindexedFieldURI("message:BccRecipients"));
FIELD_MAP.put("messageheaders", new ExtendedFieldURI(0x007D, ExtendedFieldURI.PropertyType.String)); // PR_TRANSPORT_MESSAGE_HEADERS FIELD_MAP.put("messageheaders", new ExtendedFieldURI(0x007D, ExtendedFieldURI.PropertyType.String)); // PR_TRANSPORT_MESSAGE_HEADERS
FIELD_MAP.put("contentclass", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "content-class")); FIELD_MAP.put("contentclass", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "content-class"));
FIELD_MAP.put("message-id", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, "message-id")); FIELD_MAP.put("message-id", new UnindexedFieldURI("message:InternetMessageId"));
FIELD_MAP.put("body", new UnindexedFieldURI("item:Body")); FIELD_MAP.put("body", new UnindexedFieldURI("item:Body"));
@ -233,9 +233,6 @@ public final class Field {
// attachments // attachments
FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments")); FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments"));
// headers
FIELD_MAP.put("message-id", new UnindexedFieldURI("message:InternetMessageId"));
FIELD_MAP.put("messageheaders", new ExtendedFieldURI(0x007D, ExtendedFieldURI.PropertyType.String));
} }
/** /**