mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-09 21:45:26 +00:00
Merge branch 'ejhernandez/peek-preload-bodies-for-real'
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
/* batch-mode helpers */
|
||||
- (NSString *) bodyContentPartKey;
|
||||
- (void) setBodyContentFromRawData: (NSData *) rawContent;
|
||||
- (BOOL) read; /* Unseen from sogoObject */
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user