Monotone-Parent: d5f984ad83aebee05e5bda110e339c4b94d822f3

Monotone-Revision: c2917386cf94357b49f5e5a5a2546c5d884cd132

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-02-24T20:14:17
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-02-24 20:14:17 +00:00
parent 9d8a399d1d
commit 4b719cc57c
3 changed files with 25 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2011-02-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailObject.m (_hasFlag:): put the flags in
a cache to avoid multiple queries.
2011-02-24 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m

View File

@ -53,6 +53,7 @@
id coreInfos;
id headerPart;
NSDictionary *headers;
NSArray *flagsCache;
}
/* message */

View File

@ -96,6 +96,7 @@ static BOOL debugSoParts = NO;
[headers release];
[headerPart release];
[coreInfos release];
[flagsCache release];
[super dealloc];
}
@ -804,13 +805,21 @@ static BOOL debugSoParts = NO;
/* flags */
- (void) _clearFlagsCache
{
[flagsCache release];
flagsCache = nil;
}
- (NSException *) addFlags: (id) _flags
{
[self _clearFlagsCache];
return [[self imap4Connection] addFlags:_flags toURL: [self imap4URL]];
}
- (NSException *) removeFlags: (id) _flags
{
[self _clearFlagsCache];
return [[self imap4Connection] removeFlags:_flags toURL: [self imap4URL]];
}
@ -1277,16 +1286,19 @@ static BOOL debugSoParts = NO;
{
BOOL rc;
NSDictionary *values;
NSArray *flags;
rc = NO;
values = [self _fetchProperty: @"FLAGS"];
if (values)
if (!flagsCache)
{
flags = [values objectForKey: @"flags"];
rc = [flags containsObject: flag];
values = [self _fetchProperty: @"FLAGS"];
if (values)
{
flagsCache = [values objectForKey: @"flags"];
[flagsCache retain];
}
}
rc = [flagsCache containsObject: flag];
return rc;
}