Monotone-Parent: 461db977780298f484dd530f71ae963e7dde1fc4

Monotone-Revision: 52f165b59a119e9417d23135986f09279085cc0e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-03-22T16:03:21
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2009-03-22 16:03:21 +00:00
parent a30758a22e
commit 643d2dbf47
4 changed files with 39 additions and 16 deletions

View File

@@ -1,3 +1,11 @@
2009-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -language]): cache the
language in an ivar again, that is reset when the user settings or
defaults have been loaded successfully.
([SOGoUser -userDefaults]): invoke "fetchProfile" on the defaults
instance, in order to validate the DB connection.
2009-03-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m ([SOGoUser

View File

@@ -64,7 +64,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
@interface SOGoUser : SoUser
{
SOGoUserFolder *homeFolder;
NSString *currentPassword;
NSString *language;
NSArray *allEmails;
NSString *cn;
}

View File

@@ -459,20 +459,25 @@ _timeValue (NSString *key)
defaults = [self primaryUserDefaults];
if (defaults)
{
// Required parameters for the Web interface. This will trigger the
// preferences to load so it's important to leave those calls here.
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"];
[defaults fetchProfile];
values = [defaults values];
if (values)
{
/* see explanation in -language */
[language release];
language = nil;
// Required parameters for the Web interface. This will trigger the
// preferences to load so it's important to leave those calls here.
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)
@@ -516,6 +521,9 @@ _timeValue (NSString *key)
values = [settings values];
if (values)
{
/* see explanation in -language */
[language release];
language = nil;
// 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)
@@ -542,11 +550,16 @@ _timeValue (NSString *key)
- (NSString *) language
{
NSString *language;
language = [[self userDefaults] stringForKey: @"Language"];
if (![language length])
language = [SOGoUser language];
{
language = [[self userDefaults] stringForKey: @"Language"];
if (![language length])
language = [SOGoUser language];
/* This is a hack until we handle the connection errors to the db a
better way. It enables us to avoid retrieving the userDefaults 5000
times when the DB is down, causing a huge delay. */
[language retain];
}
return language;
}

View File

@@ -318,7 +318,7 @@ static NSString *uidColumnName = @"c_uid";
- (BOOL) fetchProfile
{
return (values || [self primaryFetchProfile]);
return (values || [self primaryFetchProfile]);
}
- (NSString *) jsonRepresentation