1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

IMAP: fix deleted flag handling, switch to official Exchange IMAP property http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/0x8570

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@774 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-10-09 22:46:10 +00:00
parent 7c439595e2
commit 432e43ae14
2 changed files with 12 additions and 7 deletions

View File

@ -679,7 +679,7 @@ public class ExchangeSession {
message.answered = "102".equals(x10810003) || "103".equals(x10810003);
message.forwarded = "104".equals(x10810003);
message.date = getPropertyIfExists(properties, "date", Namespace.getNamespace("urn:schemas:mailheader:"));
message.deleted = "deleted".equals(getPropertyIfExists(properties, "contentstate", Namespace.getNamespace("http://schemas.microsoft.com/exchange/")));
message.deleted = "1".equals(getPropertyIfExists(properties, "deleted", Namespace.getNamespace("")));
message.messageId = getPropertyIfExists(properties, "message-id", Namespace.getNamespace("urn:schemas:mailheader:"));
if (message.messageId != null && message.messageId.startsWith("<") && message.messageId.endsWith(">")) {
message.messageId = message.messageId.substring(1, message.messageId.length() - 1);
@ -712,7 +712,7 @@ public class ExchangeSession {
} else if ("draft".equals(entry.getKey())) {
list.add(new DefaultDavProperty(DavPropertyName.create("x0E070003", SCHEMAS_MAPI_PROPTAG), entry.getValue()));
} else if ("deleted".equals(entry.getKey())) {
list.add(new DefaultDavProperty(DavPropertyName.create("contentstate", Namespace.getNamespace("http://schemas.microsoft.com/exchange/")), entry.getValue()));
list.add(new DefaultDavProperty(DavPropertyName.create("_x0030_x8570", Namespace.getNamespace("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/")), entry.getValue()));
} else if ("datereceived".equals(entry.getKey())) {
list.add(new DefaultDavProperty(DavPropertyName.create("datereceived", URN_SCHEMAS_HTTPMAIL), entry.getValue()));
}
@ -728,7 +728,11 @@ public class ExchangeSession {
* @throws IOException on error
*/
public void updateMessage(Message message, Map<String, String> properties) throws IOException {
PropPatchMethod patchMethod = new PropPatchMethod(URIUtil.encodePathQuery(message.messageUrl), buildProperties(properties));
PropPatchMethod patchMethod = new PropPatchMethod(URIUtil.encodePathQuery(message.messageUrl), buildProperties(properties)) {
protected void processResponseBody(HttpState httpState, HttpConnection httpConnection) {
// ignore response body, sometimes invalid with exchange mapi properties
}
};
try {
int statusCode = httpClient.executeMethod(patchMethod);
if (statusCode != HttpStatus.SC_MULTI_STATUS) {
@ -764,7 +768,8 @@ public class ExchangeSession {
" ,\"http://schemas.microsoft.com/mapi/proptag/x0e230003\"" +
" ,\"http://schemas.microsoft.com/mapi/proptag/x10830003\", \"http://schemas.microsoft.com/mapi/proptag/x10900003\"" +
" ,\"http://schemas.microsoft.com/mapi/proptag/x0E070003\", \"http://schemas.microsoft.com/mapi/proptag/x10810003\"" +
" ,\"urn:schemas:mailheader:message-id\", \"urn:schemas:httpmail:read\", \"http://schemas.microsoft.com/exchange/contentstate\", \"urn:schemas:mailheader:date\"", conditions);
" ,\"urn:schemas:mailheader:message-id\", \"urn:schemas:httpmail:read\" " +
" ,\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/0x8570\" as deleted, \"urn:schemas:mailheader:date\"", conditions);
}
/**

View File

@ -913,7 +913,7 @@ public class ImapConnection extends AbstractConnection {
message.read = true;
} else if ("\\Deleted".equals(flag)) {
message.deleted = true;
properties.put("deleted", "deleted");
properties.put("deleted", "1");
} else if ("\\Flagged".equals(flag)) {
properties.put("flagged", "2");
message.flagged = true;
@ -945,7 +945,7 @@ public class ImapConnection extends AbstractConnection {
message.read = true;
} else if ("\\Deleted".equals(flag)) {
message.deleted = true;
properties.put("deleted", "deleted");
properties.put("deleted", "1");
} else if ("\\Flagged".equals(flag)) {
properties.put("flagged", "2");
message.flagged = true;