Added the SOGoUserManager class (not used right now) to cache user preferences. Fixed tons of bugs wrt invitations handling and more cleanup needs to be done.

Monotone-Parent: 56b6e4ca9c570a4e36d00e32127d539e82da7293
Monotone-Revision: db186d0ad7ef7cd1cab54a0ee31f87daa7c32085

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-11-05T21:04:16
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2008-11-05 21:04:16 +00:00
parent 5100d6611d
commit a57e885766
30 changed files with 628 additions and 112 deletions
+18 -7
View File
@@ -20,6 +20,7 @@
*/
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDistributedNotificationCenter.h>
#import <Foundation/NSPropertyList.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
@@ -50,7 +51,6 @@ static NSString *uidColumnName = @"c_uid";
if (tableURL && [userID length] > 0
&& [defaultsFieldName length] > 0)
{
parent = [[NSUserDefaults standardUserDefaults] retain];
fieldName = [defaultsFieldName copy];
url = [tableURL copy];
uid = [userID copy];
@@ -77,7 +77,6 @@ static NSString *uidColumnName = @"c_uid";
{
[values release];
[lastFetch release];
[parent release];
[url release];
[uid release];
[fieldName release];
@@ -101,11 +100,6 @@ static NSString *uidColumnName = @"c_uid";
return fieldName;
}
- (NSUserDefaults *) parentDefaults
{
return parent;
}
/* operation */
- (BOOL) primaryFetchProfile
@@ -275,6 +269,18 @@ static NSString *uidColumnName = @"c_uid";
[self errorWithFormat: @"could not run SQL '%@': %@", sql, ex];
else
{
NSMutableDictionary *d;
d = [[NSMutableDictionary alloc] init];
[d addEntriesFromDictionary: values];
[d setObject: uid forKey: @"uid"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
object: nil
userInfo: d];
[d release];
if ([[channel adaptorContext] hasOpenTransaction])
{
ex = [channel evaluateExpressionX: @"COMMIT TRANSACTION"];
@@ -315,6 +321,11 @@ static NSString *uidColumnName = @"c_uid";
}
/* value access */
- (void) setValues: (NSDictionary *) theValues
{
[values removeAllObjects];
[values addEntriesFromDictionary: theValues];
}
- (void) setObject: (id) value
forKey: (NSString *) key