Monotone-Parent: c0283461e792310f219134254634aca1351aec58

Monotone-Revision: 3e6948059832484bb80a8445b88f9673d85ac1ba

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-11-20T20:17:01
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2009-11-20 20:17:01 +00:00
parent 5f86e04f2f
commit 9dd4c2c014
5 changed files with 90 additions and 12 deletions

View File

@ -20,6 +20,7 @@ $(SOGOD)_OBJC_FILES += \
sogod.m \
SOGo.m \
SOGoProductLoader.m \
SOGoStartupLogger.m \
build.m
-include GNUmakefile.preamble

View File

@ -59,12 +59,7 @@
#import "NSException+Stacktrace.h"
#import "SOGo.h"
@interface SOGoStartupLogger : NSObject
@end
@implementation SOGoStartupLogger
@end
#import "SOGoStartupLogger.h"
@implementation SOGo
@ -88,7 +83,7 @@ static BOOL debugLeaks = NO;
SOGoStartupLogger *logger;
id tmp;
logger = [SOGoStartupLogger new];
logger = [SOGoStartupLogger sharedLogger];
[logger logWithFormat: @"starting SOGo (build %@)", SOGoBuildDate];
ud = [NSUserDefaults standardUserDefaults];
@ -132,7 +127,6 @@ static BOOL debugLeaks = NO;
trustProxyAuthentication = [ud boolForKey: @"SOGoTrustProxyAuthentication"];
useRelativeURLs = [ud boolForKey: @"WOUseRelativeURLs"];
[logger release];
}
- (id) init

View File

@ -0,0 +1,34 @@
/* SOGoStartupLogger.h - this file is part of SOGo
*
* Copyright (C) 2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef SOGOSTARTUPLOGGER_H
#define SOGOSTARTUPLOGGER_H
#import <NGExtensions/NSObject+Logs.h>
@interface SOGoStartupLogger : NSObject
+ (id) sharedLogger;
@end
#endif /* SOGOSTARTUPLOGGER_H */

View File

@ -0,0 +1,37 @@
/* SOGoStartupLogger.m - this file is part of $PROJECT_NAME_HERE$
*
* Copyright (C) 2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import "SOGoStartupLogger.h"
@implementation SOGoStartupLogger
+ (id) sharedLogger
{
static id logger = nil;
if (!logger)
logger = [self new];
return logger;
}
@end

View File

@ -32,6 +32,7 @@
#if defined(LDAP_CONFIG)
#import <SOGo/SOGoLDAPUserDefaults.h>
#endif
#import "SOGoStartupLogger.h"
typedef void (*NSUserDefaultsInitFunction) ();
@ -60,6 +61,9 @@ prepareUserDefaults (NSUserDefaults *ud)
{
NSString *redirectURL;
NSDictionary *domain;
SOGoStartupLogger *logger;
logger = [SOGoStartupLogger sharedLogger];
domain = [ud persistentDomainForName: @"sogod"];
if (![domain count])
@ -67,7 +71,7 @@ prepareUserDefaults (NSUserDefaults *ud)
domain = [ud persistentDomainForName: @"sogod-0.9"];
if ([domain count])
{
NSLog (@"migrating user defaults from sogod-0.9");
[logger logWithFormat: @"migrating user defaults from sogod-0.9"];
[ud setPersistentDomain: domain forName: @"sogod"];
[ud removePersistentDomainForName: @"sogod-0.9"];
[ud synchronize];
@ -75,9 +79,17 @@ prepareUserDefaults (NSUserDefaults *ud)
}
redirectURL = [ud stringForKey: @"WOApplicationRedirectURL"];
if ([redirectURL hasSuffix: @"/"])
[ud setObject: [redirectURL substringToIndex: [redirectURL length] - 1]
forKey: @"WOApplicationRedirectURL"];
if (redirectURL)
{
[logger warnWithFormat:
@"Using obsolete 'WOApplicationRedirectURL' user default."];
[logger warnWithFormat:
@" Please configure the use of the x-webobjects-XXX headers"
@" with your webserver (see sample files)."];
if ([redirectURL hasSuffix: @"/"])
[ud setObject: [redirectURL substringToIndex: [redirectURL length] - 1]
forKey: @"WOApplicationRedirectURL"];
}
[ud setBool: YES forKey: @"WOMessageUseUTF8"];
[ud setBool: YES forKey: @"WOParsersUseUTF8"];
[ud setBool: YES forKey: @"NGUseUTF8AsURLEncoding"];