From 126b92fb1ec6997f0e711062e0c54af07d10e29e Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 26 Nov 2009 19:34:56 +0000 Subject: [PATCH] Monotone-Parent: f617866a91a29b390f0a2207ceb975bf2b2eeaa3 Monotone-Revision: e862ec9df7a40d9361fca6b959f96c844ff74060 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-26T19:34:56 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/SOGo/SOGoUserDefaults.m | 28 +++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d3c0ee1b..21a7f0841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-11-26 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoUserDefaults.m (-synchronize): avoid fetching + the values from the database/the cache when they are successfully + stored. + * SoObjects/SOGo/SOGoCache.m (_cacheValues:ofType:forLogin:): we also fill the local cache with the new value to avoid ignoring it next time the cache is invoked. diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index e3e59e884..55472cc50 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -465,25 +465,31 @@ static NSString *uidColumnName = @"c_uid"; - (BOOL) synchronize { + BOOL rc; // if (!defFlags.modified) /* was not modified */ // return YES; + rc = NO; + /* ensure fetched data (more or less guaranteed by modified!=0) */ [self fetchProfile]; - if (!values) - return NO; - - /* store */ - if (![self primaryStoreProfile]) + if (values) { - [self primaryFetchProfile]; - return NO; + /* store */ + if ([self primaryStoreProfile]) + { + rc = YES; + // /* refetch */ + // [self primaryFetchProfile]; + } + else + { + [self primaryFetchProfile]; + return NO; + } } - /* refetch */ - [self primaryFetchProfile]; - - return YES; + return rc; } /* typed accessors */