diff --git a/Main/GNUmakefile b/Main/GNUmakefile index d8d1b3398..da53c5370 100644 --- a/Main/GNUmakefile +++ b/Main/GNUmakefile @@ -20,6 +20,7 @@ $(SOGOD)_OBJC_FILES += \ sogod.m \ SOGo.m \ SOGoProductLoader.m \ + SOGoStartupLogger.m \ build.m -include GNUmakefile.preamble diff --git a/Main/SOGo.m b/Main/SOGo.m index d15342cec..99a62671e 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -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 diff --git a/Main/SOGoStartupLogger.h b/Main/SOGoStartupLogger.h new file mode 100644 index 000000000..2e6c0b368 --- /dev/null +++ b/Main/SOGoStartupLogger.h @@ -0,0 +1,34 @@ +/* SOGoStartupLogger.h - this file is part of SOGo + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Wolfgang Sourdeau + * + * 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 + +@interface SOGoStartupLogger : NSObject + ++ (id) sharedLogger; + +@end + +#endif /* SOGOSTARTUPLOGGER_H */ diff --git a/Main/SOGoStartupLogger.m b/Main/SOGoStartupLogger.m new file mode 100644 index 000000000..747986ccb --- /dev/null +++ b/Main/SOGoStartupLogger.m @@ -0,0 +1,37 @@ +/* SOGoStartupLogger.m - this file is part of $PROJECT_NAME_HERE$ + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Wolfgang Sourdeau + * + * 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 diff --git a/Main/sogod.m b/Main/sogod.m index 167fca2a8..6b02d95ff 100644 --- a/Main/sogod.m +++ b/Main/sogod.m @@ -32,6 +32,7 @@ #if defined(LDAP_CONFIG) #import #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"];