From 9f3f2aebe458a6cb6ea94aa9e32d2607f83afb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Thu, 12 Mar 2015 20:24:06 +0100 Subject: [PATCH] oc-mail: Register source message as soft deleted on movement This makes sent mails are not longer automatically copied to Drafts folder. Reasoning: When Outlook sends a mail, OpenChange submits the message and copy the message to Drafts folder. Afterwards, the client asks to move this message using SyncImportMessageMove ROP from Drafts to Sent. During this movement, the message is unregistered from the indexing database. If the client has updated Drafts folder before that movement, then the client will keep this message as the MID is not returned in oxcfxics download sync as deleted. Setting the message as soft deleted, make it work. --- NEWS | 1 + OpenChange/MAPIStoreMailFolder.m | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index bae4a7cd6..808c508e6 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Enhancements - Appointment color and importance work now between Outlooks Bug fixes + - Sent mails are not longer in Drafts folder using Outlook - Fix sender on importing email messages like event invitations - Fix Outlook crashes when modifying the view of a folder - Fix server side crash when reading some recurrence appointments diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index 0a439e29e..5c70dc634 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -1163,13 +1163,20 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) if (![[result objectForKey: @"result"] boolValue]) return MAPISTORE_ERROR; - /* "Move" treatment: Store \Deleted and unregister urls */ + /* "Move" treatment: Store \Deleted and unregister urls as soft-deleted */ if (!wantCopy) { [client storeFlags: [NSArray arrayWithObject: @"Deleted"] forUIDs: uids addOrRemove: YES]; for (count = 0; count < midCount; count++) - [mapping unregisterURLWithID: srcMids[count]]; + { + /* Using soft-deleted to make deleted fmids to return the + srcMids. + See [MAPIStoreFolder getDeletedFMIDs:andCN:fromChangeNumber:inTableType:inMemCtx] + for details */ + [mapping unregisterURLWithID: srcMids[count] + andFlags: MAPISTORE_SOFT_DELETE]; + } } /* Registration of target messages */