Revert "oc-mailfolder: Avoid setting seen flag on preloading message bodies"

This reverts commit 7e0cddc06b.
pull/65/head
Enrique J. Hernández Blasco 2015-03-13 00:00:40 +01:00
parent 6d6053865f
commit f048860729
1 changed files with 1 additions and 30 deletions

View File

@ -1476,10 +1476,8 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
NSUInteger count, max;
NSString *messageKey, *messageUid, *bodyPartKey;
NGImap4Client *client;
NSArray *fetch, *flags;
NSArray *fetch;
NSData *bodyContent;
BOOL unseen;
NSMutableArray *unseenUIDs;
if (tableType == MAPISTORE_MESSAGE_TABLE)
{
@ -1509,25 +1507,6 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
client = [[(SOGoMailFolder *) sogoObject imap4Connection] client];
[client select: [sogoObject absoluteImap4Name]];
/* Fetch flags to remove seen flag if required,
as fetching a message body set the seen flag */
response = [client fetchUids: [keyAssoc allKeys]
parts: [NSArray arrayWithObjects: @"flags", nil]];
fetch = [response objectForKey: @"fetch"];
max = [fetch count];
unseenUIDs = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
response = [fetch objectAtIndex: count];
messageUid = [[response objectForKey: @"uid"] stringValue];
flags = [response objectForKey: @"flags"];
unseen = [flags indexOfObject: @"seen"] == NSNotFound;
if (unseen) {
[unseenUIDs addObject: messageUid];
}
}
response = [client fetchUids: [keyAssoc allKeys]
parts: [bodyPartKeys allObjects]];
fetch = [response objectForKey: @"fetch"];
@ -1549,14 +1528,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];
}
}
}