From 61f99524fc19228cf924b49caf6f3ea6cfdd3fe8 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 12 Aug 2011 20:10:28 +0000 Subject: [PATCH] Monotone-Parent: afb8a72eddabdfbaa3b6865a4ebc2398294e95c3 Monotone-Revision: 72951a15317b904c573f349f0cc5252a50749fd3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-08-12T20:10:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++++ SoObjects/Mailer/SOGoMailObject.h | 1 - SoObjects/Mailer/SOGoMailObject.m | 28 +++++++--------------------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63c145f67..beb35e44e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-08-12 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailObject.m: (addFlags:, removeFlags:) + release "coreInfos" rather than flagsCache, which has been + obsoleted. + (_hasFlag:): make use of "coreInfos" to fetch the flags since most + of the time the other infos will be fetch for the same object, + bringing a 30ms speedup per message. + * OpenChange/MAPIStoreTable.m (-setHandleId:): only register the table in the notification cache if the provided handle id is not null. diff --git a/SoObjects/Mailer/SOGoMailObject.h b/SoObjects/Mailer/SOGoMailObject.h index e93caa988..148d8cf85 100644 --- a/SoObjects/Mailer/SOGoMailObject.h +++ b/SoObjects/Mailer/SOGoMailObject.h @@ -53,7 +53,6 @@ id coreInfos; id headerPart; NSDictionary *headers; - NSArray *flagsCache; } /* message */ diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 0ae34663c..6dcda1741 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -96,7 +96,6 @@ static BOOL debugSoParts = NO; [headers release]; [headerPart release]; [coreInfos release]; - [flagsCache release]; [super dealloc]; } @@ -805,21 +804,17 @@ static BOOL debugSoParts = NO; /* flags */ -- (void) _clearFlagsCache -{ - [flagsCache release]; - flagsCache = nil; -} - - (NSException *) addFlags: (id) _flags { - [self _clearFlagsCache]; + [coreInfos release]; + coreInfos = nil; return [[self imap4Connection] addFlags:_flags toURL: [self imap4URL]]; } - (NSException *) removeFlags: (id) _flags { - [self _clearFlagsCache]; + [coreInfos release]; + coreInfos = nil; return [[self imap4Connection] removeFlags:_flags toURL: [self imap4URL]]; } @@ -1285,19 +1280,10 @@ static BOOL debugSoParts = NO; - (BOOL) _hasFlag: (NSString *) flag { BOOL rc; - NSDictionary *values; + NSArray *flags; - if (!flagsCache) - { - values = [self _fetchProperty: @"FLAGS"]; - if (values) - { - flagsCache = [values objectForKey: @"flags"]; - [flagsCache retain]; - } - } - - rc = [flagsCache containsObject: flag]; + flags = [[self fetchCoreInfos] objectForKey: @"flags"]; + rc = [flags containsObject: flag]; return rc; }