Monotone-Parent: d5f984ad83aebee05e5bda110e339c4b94d822f3

Monotone-Revision: c2917386cf94357b49f5e5a5a2546c5d884cd132

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-02-24T20:14:17
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
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> 2011-02-24 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m * SoObjects/Appointments/SOGoAppointmentFolder.m

View file

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

View file

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