Monotone-Parent: 694600692b70cc30ffc96cddeb455dc83bc72078

Monotone-Revision: 71e8d6e738a201066fe20c3c31bde9c788ee9743

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-02-04T16:08:13
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2011-02-04 16:08:13 +00:00
parent 6e2d8b12b9
commit cf9d12009e
2 changed files with 24 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2011-02-04 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-02-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreMailMessageTable.m (-childKeys)
(-restrictedChildKeys): now only return non-deleted elements.
* OpenChange/SOGoMAPIFSMessage.m (-MAPISave): use an alternative * OpenChange/SOGoMAPIFSMessage.m (-MAPISave): use an alternative
way of producing the property list file as, for some reason, way of producing the property list file as, for some reason,
invoking -writeToFile:atomically: can fail on NSDictionary. invoking -writeToFile:atomically: can fail on NSDictionary.

View file

@ -27,6 +27,8 @@
#import <NGExtensions/NSObject+Logs.h> #import <NGExtensions/NSObject+Logs.h>
#import <EOControl/EOQualifier.h>
#import <SOGo/NSArray+Utilities.h> #import <SOGo/NSArray+Utilities.h>
#import <Mailer/SOGoMailFolder.h> #import <Mailer/SOGoMailFolder.h>
@ -47,20 +49,34 @@
static Class NSDataK, NSStringK; static Class NSDataK, NSStringK;
static EOQualifier *nonDeletedQualifier = nil;
+ (void) initialize + (void) initialize
{ {
EOKeyValueQualifier *deletedQualifier;
NSDataK = [NSData class]; NSDataK = [NSData class];
NSStringK = [NSString class]; NSStringK = [NSString class];
deletedQualifier = [[EOKeyValueQualifier alloc]
initWithKey: @"FLAGS"
operatorSelector: EOQualifierOperatorContains
value: [NSArray arrayWithObject: @"DELETED"]];
nonDeletedQualifier = [[EONotQualifier alloc]
initWithQualifier: deletedQualifier];
[deletedQualifier release];
} }
- (NSArray *) childKeys - (NSArray *) childKeys
{ {
return [folder toOneRelationshipKeys]; return [[folder fetchUIDsMatchingQualifier: nonDeletedQualifier
sortOrdering: @"ARRIVAL"]
stringsWithFormat: @"%@.eml"];
} }
- (NSArray *) restrictedChildKeys - (NSArray *) restrictedChildKeys
{ {
NSArray *keys; NSArray *keys;
EOAndQualifier *andQualifier;
if (restrictionState == MAPIRestrictionStateAlwaysTrue) if (restrictionState == MAPIRestrictionStateAlwaysTrue)
keys = [self cachedChildKeys]; keys = [self cachedChildKeys];
@ -68,9 +84,12 @@ static Class NSDataK, NSStringK;
keys = [NSArray array]; keys = [NSArray array];
else else
{ {
keys = [[folder fetchUIDsMatchingQualifier: restriction andQualifier = [[EOAndQualifier alloc]
initWithQualifiers: restriction, nonDeletedQualifier, nil];
keys = [[folder fetchUIDsMatchingQualifier: andQualifier
sortOrdering: @"ARRIVAL"] sortOrdering: @"ARRIVAL"]
stringsWithFormat: @"%@.eml"]; stringsWithFormat: @"%@.eml"];
[andQualifier release];
[self logWithFormat: @" restricted keys: %@", keys]; [self logWithFormat: @" restricted keys: %@", keys];
} }