IMAP: additional fix for Exchange 2010 header search, use PR_TRANSPORT_MESSAGE_HEADERS
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1986 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
a94826b21f
commit
0238281523
|
@ -796,20 +796,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class HeaderCondition extends AttributeCondition {
|
protected static class HeaderCondition extends AttributeCondition {
|
||||||
|
|
||||||
protected HeaderCondition(String attributeName, Operator operator, String value) {
|
protected HeaderCondition(String attributeName, String value) {
|
||||||
super(attributeName, operator, value);
|
super(attributeName, Operator.Contains, value);
|
||||||
|
containmentMode = ContainmentMode.Substring;
|
||||||
|
containmentComparison = ContainmentComparison.IgnoreCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FieldURI getFieldURI() {
|
protected FieldURI getFieldURI() {
|
||||||
// Exchange 2010 does not support header search
|
return new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, attributeName);
|
||||||
if (serverVersion.startsWith("Exchange2010") && "message-id".equals(attributeName)) {
|
|
||||||
return new UnindexedFieldURI("message:InternetMessageId");
|
|
||||||
} else {
|
|
||||||
return new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.InternetHeaders, attributeName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -865,7 +862,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Condition headerIsEqualTo(String headerName, String value) {
|
public Condition headerIsEqualTo(String headerName, String value) {
|
||||||
return new HeaderCondition(headerName, Operator.IsEqualTo, value);
|
if (serverVersion.startsWith("Exchange2010")) {
|
||||||
|
if ("message-id".equals(headerName)) {
|
||||||
|
return new AttributeCondition(headerName, Operator.Contains, value, ContainmentMode.Substring, ContainmentComparison.IgnoreCase);
|
||||||
|
} else {
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new HeaderCondition(headerName, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -232,6 +232,10 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue