Monotone-Parent: 6e1829513cdcf98135e56f857438e77218ae7851

Monotone-Revision: ef58e70b7d00dc34a5d02557365841c574086751

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-03-20T17:35:49
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2009-03-20 17:35:49 +00:00
parent 273415b671
commit 0ca3d9d7b0
2 changed files with 62 additions and 40 deletions

View File

@ -1,3 +1,10 @@
2009-03-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -userDefaults]): ensure the
values are not nil before putting them in the cache. This fixes an
exception occuring for setting a nil key in a dictionary.
([SOGoUser -userSettings]): same as above.
2009-03-19 Francis Lachapelle <flachapelle@inverse.ca>
* UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions

View File

@ -451,40 +451,47 @@ _timeValue (NSString *key)
- (NSUserDefaults *) userDefaults
{
SOGoUserDefaults *defaults;
NSDictionary *values;
NSMutableDictionary *d;
defaults = [[SOGoCache sharedCache] userDefaultsForLogin: login];
if (!defaults)
{
NSMutableDictionary *d;
defaults = [self primaryUserDefaults];
if (defaults)
{
// Required parameters for the Web interface
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"];
// Required parameters for the Web interface
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"];
// We propagate the loaded user defaults to other sogod instances
// which will cache them in SOGoCache (including for the instance
// that actually posts the notification)
values = [defaults values];
if (values)
{
d = [NSMutableDictionary dictionary];
[d setObject: values forKey: @"values"];
[d setObject: login forKey: @"uid"];
[d setObject: [SOGoProfileURL absoluteString] forKey: @"url"];
// We propagate the loaded user defaults to other sogod instances
// which will cache them in SOGoCache (including for the instance
// that actually posts the notification)
d = [NSMutableDictionary dictionary];
[d setObject: [defaults values] forKey: @"values"];
[d setObject: login forKey: @"uid"];
[d setObject: [SOGoProfileURL absoluteString] forKey: @"url"];
[[SOGoCache sharedCache] setDefaults: defaults
forLogin: login key: @"defaults"];
[[SOGoCache sharedCache] setDefaults: defaults forLogin: login key: @"defaults"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserDefaultsHaveLoaded"
object: nil
userInfo: d
deliverImmediately: YES];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserDefaultsHaveLoaded"
object: nil
userInfo: d
deliverImmediately: YES];
}
}
}
//else
// NSLog(@"User defaults cache hit for %@", login);
@ -495,6 +502,7 @@ _timeValue (NSString *key)
- (NSUserDefaults *) userSettings
{
SOGoUserDefaults *settings;
NSDictionary *values;
settings = [[SOGoCache sharedCache] userSettingsForLogin: login];
@ -503,22 +511,29 @@ _timeValue (NSString *key)
NSMutableDictionary *d;
settings = [self primaryUserSettings];
[settings fetchProfile];
// We propagate the loaded user settings to other sogod instances
// which will cache them in SOGoCache (including for the instance
// that actually posts the notification)
d = [NSMutableDictionary dictionary];
[d setObject: [settings values] forKey: @"values"];
[d setObject: login forKey: @"uid"];
[d setObject: [SOGoProfileURL absoluteString] forKey: @"url"];
if (settings)
{
[settings fetchProfile];
values = [settings values];
if (values)
{
// We propagate the loaded user settings to other sogod instances
// which will cache them in SOGoCache (including for the instance
// that actually posts the notification)
d = [NSMutableDictionary dictionary];
[d setObject: values forKey: @"values"];
[d setObject: login forKey: @"uid"];
[d setObject: [SOGoProfileURL absoluteString] forKey: @"url"];
[[SOGoCache sharedCache] setDefaults: settings forLogin: login key: @"settings"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserSettingsHaveLoaded"
object: nil
userInfo: d
deliverImmediately: YES];
[[SOGoCache sharedCache] setDefaults: settings forLogin: login key: @"settings"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserSettingsHaveLoaded"
object: nil
userInfo: d
deliverImmediately: YES];
}
}
}
//else
// NSLog(@"User settings cache hit for %@", login);