mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-21 21:09:28 +00:00
Revert "oc-mailfolder: Get seen flag directly from message in preloading"
This reverts commit d076e04ad4.
This commit is contained in:
@@ -1476,8 +1476,9 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||
NSUInteger count, max;
|
||||
NSString *messageKey, *messageUid, *bodyPartKey;
|
||||
NGImap4Client *client;
|
||||
NSArray *fetch;
|
||||
NSArray *fetch, *flags;
|
||||
NSData *bodyContent;
|
||||
BOOL unseen;
|
||||
NSMutableArray *unseenUIDs;
|
||||
|
||||
if (tableType == MAPISTORE_MESSAGE_TABLE)
|
||||
@@ -1489,7 +1490,6 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||
{
|
||||
bodyPartKeys = [NSMutableSet setWithCapacity: max];
|
||||
|
||||
unseenUIDs = [NSMutableArray arrayWithCapacity: max];
|
||||
keyAssoc = [NSMutableDictionary dictionaryWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
@@ -1503,15 +1503,6 @@ _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 (![message read])
|
||||
{
|
||||
[unseenUIDs addObject: messageUid];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1519,6 +1510,24 @@ _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"];
|
||||
@@ -1541,7 +1550,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore unseen state once the body has been fetched */
|
||||
// Restore unseen state once the body has been fetched
|
||||
if ([unseenUIDs count] > 0)
|
||||
{
|
||||
response = [client storeFlags: [NSArray arrayWithObjects: @"seen", nil]
|
||||
|
||||
Reference in New Issue
Block a user