diff --git a/NEWS b/NEWS index 7e94ecd64..506495dc7 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ master ------ +Enhancements + - Improve sync speed from Outlook by non-reprocessing already downloaded unread mails + Bug fixes - Sent mails are not longer in Drafts folder using Outlook - Fix server side crash parsing rtf emails with images (with word97 format) diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index 5c70dc634..ba2339586 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -1485,7 +1485,6 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) NGImap4Client *client; NSArray *fetch; NSData *bodyContent; - NSMutableArray *unseenUIDs; if (tableType == MAPISTORE_MESSAGE_TABLE) { @@ -1496,7 +1495,6 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) { bodyPartKeys = [NSMutableSet setWithCapacity: max]; - unseenUIDs = [NSMutableArray arrayWithCapacity: max]; keyAssoc = [NSMutableDictionary dictionaryWithCapacity: max]; for (count = 0; count < max; count++) { @@ -1509,23 +1507,22 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) { [bodyPartKeys addObject: bodyPartKey]; messageUid = [self messageUIDFromMessageKey: messageKey]; - [keyAssoc setObject: bodyPartKey forKey: messageUid]; - /* Fetch flags to remove seen flag if required, - as fetching a message body set the seen flag. - We are not using body.peek[] as - bodyContentPartKey explicitly avoids it. + /* If the bodyPartKey include peek, remove it as it is not returned + as key in the IMAP server response. + + IMAP conversation example: + a4 UID FETCH 1 (UID BODY.PEEK[text]) + * 1 FETCH (UID 1 BODY[TEXT] {1677} */ - if (![message read]) - { - [unseenUIDs addObject: messageUid]; - } + bodyPartKey = [bodyPartKey stringByReplacingOccurrencesOfString: @"body.peek" + withString: @"body"]; + [keyAssoc setObject: bodyPartKey forKey: messageUid]; } } } client = [[(SOGoMailFolder *) sogoObject imap4Connection] client]; [client select: [sogoObject absoluteImap4Name]]; - response = [client fetchUids: [keyAssoc allKeys] parts: [bodyPartKeys allObjects]]; fetch = [response objectForKey: @"fetch"]; @@ -1547,14 +1544,6 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) } } } - - /* Restore unseen state once the body has been fetched */ - if ([unseenUIDs count] > 0) - { - response = [client storeFlags: [NSArray arrayWithObjects: @"seen", nil] - forUIDs: unseenUIDs - addOrRemove: NO]; - } } } diff --git a/OpenChange/MAPIStoreMailMessage.h b/OpenChange/MAPIStoreMailMessage.h index 2f6192c16..fffd0c422 100644 --- a/OpenChange/MAPIStoreMailMessage.h +++ b/OpenChange/MAPIStoreMailMessage.h @@ -74,7 +74,6 @@ /* batch-mode helpers */ - (NSString *) bodyContentPartKey; - (void) setBodyContentFromRawData: (NSData *) rawContent; -- (BOOL) read; /* Unseen from sogoObject */ @end diff --git a/OpenChange/MAPIStoreMailMessage.m b/OpenChange/MAPIStoreMailMessage.m index 4c6fba488..8c35f4265 100644 --- a/OpenChange/MAPIStoreMailMessage.m +++ b/OpenChange/MAPIStoreMailMessage.m @@ -1627,11 +1627,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data) if (!headerSetup) [self _fetchHeaderData]; - if ([mimeKey hasPrefix: @"body.peek"]) - bodyPartKey = [NSString stringWithFormat: @"body[%@]", - [mimeKey _strippedBodyKey]]; - else - bodyPartKey = mimeKey; + bodyPartKey = mimeKey; return bodyPartKey; } @@ -1660,12 +1656,4 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data) } } -- (BOOL) read -{ - if (!headerSetup) - [self _fetchHeaderData]; - - return [sogoObject read]; -} - @end