mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-04 21:08:51 +00:00
merge of '8f10a117c2f432bdcc1ea03aecbe4854d53449ee'
and 'af789fd2e2a4e534fd7125c5adc6956afb527781' Monotone-Parent: 8f10a117c2f432bdcc1ea03aecbe4854d53449ee Monotone-Parent: af789fd2e2a4e534fd7125c5adc6956afb527781 Monotone-Revision: 62e39c3bdb32b49561def293946775b53c6ec7a8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-01-13T20:41:38 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2009-01-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -userDefaults]): make use
|
||||
of more explicit names for the variables used. Invoke a new [self
|
||||
primaryUserDefaults] that fetches the defaults from the database,
|
||||
so as to separate that mechanism from the caching mechanisme.
|
||||
([SOGoUser -userSettings]): same as above.
|
||||
|
||||
2009-01-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject
|
||||
|
||||
@@ -289,6 +289,7 @@ withName: (NSString *) name
|
||||
{
|
||||
SOGoUser *user;
|
||||
NSString *uid;
|
||||
SOGoUserDefaults *defaults;
|
||||
|
||||
uid = [[theNotification userInfo] objectForKey: @"uid"];
|
||||
|
||||
@@ -297,8 +298,9 @@ withName: (NSString *) name
|
||||
#endif
|
||||
if ((user = [users objectForKey: uid]))
|
||||
{
|
||||
[[user userDefaults] setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[SOGoCache setCachedUserDefaults: (SOGoUserDefaults*)[user userDefaults] user: uid];
|
||||
defaults = (SOGoUserDefaults *) [user userDefaults];
|
||||
[defaults setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[SOGoCache setCachedUserDefaults: defaults user: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -313,13 +315,15 @@ withName: (NSString *) name
|
||||
{
|
||||
SOGoUser *user;
|
||||
NSString *uid;
|
||||
|
||||
SOGoUserDefaults *settings;
|
||||
|
||||
uid = [[theNotification userInfo] objectForKey: @"uid"];
|
||||
|
||||
if ((user = [users objectForKey: uid]))
|
||||
{
|
||||
[[user userSettings] setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[SOGoCache setCachedUserSettings: (SOGoUserDefaults *)[user userSettings] user: uid];
|
||||
settings = (SOGoUserDefaults *) [user userSettings];
|
||||
[settings setValues: [[theNotification userInfo] objectForKey: @"values"]];
|
||||
[SOGoCache setCachedUserSettings: settings user: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -187,7 +187,7 @@ _timeValue (NSString *key)
|
||||
if (!defaultMessageCheck)
|
||||
ASSIGN (defaultMessageCheck, @"manually");
|
||||
}
|
||||
|
||||
|
||||
if (!superUsernames)
|
||||
ASSIGN (superUsernames, [ud arrayForKey: @"SOGoSuperUsernames"]);
|
||||
|
||||
@@ -349,7 +349,7 @@ _timeValue (NSString *key)
|
||||
if (!allEmails)
|
||||
[self _fetchAllEmails];
|
||||
|
||||
return allEmails;
|
||||
return allEmails;
|
||||
}
|
||||
|
||||
- (NSString *) systemEmail
|
||||
@@ -364,7 +364,7 @@ _timeValue (NSString *key)
|
||||
{
|
||||
if (!allEmails)
|
||||
[self _fetchAllEmails];
|
||||
|
||||
|
||||
return [allEmails containsCaseInsensitiveString: email];
|
||||
}
|
||||
|
||||
@@ -464,54 +464,72 @@ _timeValue (NSString *key)
|
||||
return dateFormatter;
|
||||
}
|
||||
|
||||
- (SOGoUserDefaults *) primaryUserDefaults
|
||||
{
|
||||
SOGoUserDefaults *o;
|
||||
|
||||
o = [[SOGoUserDefaults alloc] initWithTableURL: SOGoProfileURL
|
||||
uid: login
|
||||
fieldName: @"c_defaults"];
|
||||
[o autorelease];
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
- (SOGoUserDefaults *) primaryUserSettings
|
||||
{
|
||||
SOGoUserDefaults *o;
|
||||
|
||||
o = [[SOGoUserDefaults alloc] initWithTableURL: SOGoProfileURL
|
||||
uid: login
|
||||
fieldName: @"c_settings"];
|
||||
[o autorelease];
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
- (NSUserDefaults *) userDefaults
|
||||
{
|
||||
id o;
|
||||
|
||||
o = [[SOGoCache cachedUserDefaults] objectForKey: login];
|
||||
SOGoUserDefaults *defaults;
|
||||
NSDictionary *cachedDefaults;
|
||||
|
||||
if (!o)
|
||||
{
|
||||
o = [[SOGoUserDefaults alloc] initWithTableURL: SOGoProfileURL
|
||||
uid: login
|
||||
fieldName: @"c_defaults"];
|
||||
cachedDefaults = [[SOGoCache cachedUserDefaults] objectForKey: login];
|
||||
if (cachedDefaults)
|
||||
defaults = [cachedDefaults objectForKey: @"dictionary"];
|
||||
else
|
||||
{
|
||||
defaults = [self primaryUserDefaults];
|
||||
/* Required parameters for the web interface */
|
||||
if (![[o stringForKey: @"ReplyPlacement"] length])
|
||||
[o setObject: defaultReplyPlacement forKey: @"ReplyPlacement"];
|
||||
if (![[o stringForKey: @"SignaturePlacement"] length])
|
||||
[o setObject: defaultSignaturePlacement forKey: @"SignaturePlacement"];
|
||||
if (![[o stringForKey: @"MessageForwarding"] length])
|
||||
[o setObject: defaultMessageForwarding forKey: @"MessageForwarding"];
|
||||
if (![[o stringForKey: @"MessageCheck"] length])
|
||||
[o setObject: defaultMessageCheck forKey: @"MessageCheck"];
|
||||
if (![[defaults stringForKey: @"ReplyPlacement"] length])
|
||||
[defaults setObject: defaultReplyPlacement forKey: @"ReplyPlacement"];
|
||||
if (![[defaults stringForKey: @"SignaturePlacement"] length])
|
||||
[defaults setObject: defaultSignaturePlacement forKey: @"SignaturePlacement"];
|
||||
if (![[defaults stringForKey: @"MessageForwarding"] length])
|
||||
[defaults setObject: defaultMessageForwarding forKey: @"MessageForwarding"];
|
||||
if (![[defaults stringForKey: @"MessageCheck"] length])
|
||||
[defaults setObject: defaultMessageCheck forKey: @"MessageCheck"];
|
||||
|
||||
[SOGoCache setCachedUserDefaults: o user: login];
|
||||
[o release];
|
||||
|
||||
return o;
|
||||
[SOGoCache setCachedUserDefaults: defaults user: login];
|
||||
}
|
||||
|
||||
return [o objectForKey: @"dictionary"];
|
||||
return (NSUserDefaults *) defaults;
|
||||
}
|
||||
|
||||
- (NSUserDefaults *) userSettings
|
||||
{
|
||||
id o;
|
||||
|
||||
o = [[SOGoCache cachedUserSettings] objectForKey: login];
|
||||
SOGoUserDefaults *settings;
|
||||
NSDictionary *cachedSettings;
|
||||
|
||||
if (!o)
|
||||
{
|
||||
o = [[SOGoUserDefaults alloc] initWithTableURL: SOGoProfileURL
|
||||
uid: login
|
||||
fieldName: @"c_settings"];
|
||||
[SOGoCache setCachedUserSettings: o user: login];
|
||||
[o release];
|
||||
|
||||
return o;
|
||||
cachedSettings = [[SOGoCache cachedUserSettings] objectForKey: login];
|
||||
if (cachedSettings)
|
||||
settings = [cachedSettings objectForKey: @"dictionary"];
|
||||
else
|
||||
{
|
||||
settings = [self primaryUserSettings];
|
||||
[SOGoCache setCachedUserSettings: settings user: login];
|
||||
}
|
||||
|
||||
return [o objectForKey: @"dictionary"];
|
||||
return (NSUserDefaults *) settings;
|
||||
}
|
||||
|
||||
- (NSString *) language
|
||||
@@ -897,12 +915,12 @@ _timeValue (NSString *key)
|
||||
// folder = [self homeFolderInContext:_ctx];
|
||||
// if ([folder isKindOfClass:[NSException class]])
|
||||
// return folder;
|
||||
|
||||
|
||||
// folder = [folder lookupName:@"Calendar" inContext:_ctx acquire:NO];
|
||||
// if ([folder isKindOfClass:[NSException class]])
|
||||
// return folder;
|
||||
|
||||
// [(WOContext *)_ctx setObject:folder ? folder : [NSNull null]
|
||||
|
||||
// [(WOContext *)_ctx setObject:folder ? folder : [NSNull null]
|
||||
// forKey:@"ActiveUserCalendar"];
|
||||
// return folder;
|
||||
// }
|
||||
|
||||
@@ -47,7 +47,7 @@ static NSString *uidColumnName = @"c_uid";
|
||||
uid: (NSString *) userID
|
||||
fieldName: (NSString *) defaultsFieldName
|
||||
{
|
||||
if ((self = [super init]))
|
||||
if ((self = [self init]))
|
||||
{
|
||||
if (tableURL && [userID length] > 0
|
||||
&& [defaultsFieldName length] > 0)
|
||||
@@ -67,13 +67,6 @@ static NSString *uidColumnName = @"c_uid";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
[self release];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[values release];
|
||||
@@ -296,16 +289,17 @@ static NSString *uidColumnName = @"c_uid";
|
||||
{
|
||||
NSMutableDictionary *d;
|
||||
|
||||
d = [[NSMutableDictionary alloc] init];
|
||||
d = [NSMutableDictionary dictionary];
|
||||
[d setObject: values forKey: @"values"];
|
||||
[d setObject: uid forKey: @"uid"];
|
||||
|
||||
|
||||
[[NSDistributedNotificationCenter defaultCenter]
|
||||
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
|
||||
postNotificationName: ([fieldName isEqualToString: @"c_defaults"]
|
||||
? @"SOGoUserDefaultsHaveChanged"
|
||||
: @"SOGoUserSettingsHaveChanged")
|
||||
object: nil
|
||||
userInfo: d
|
||||
deliverImmediately: YES];
|
||||
[d release];
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user