mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-24 07:32:44 +00:00
merge of '8284970df75a548f065196f3da7fcd70bc8c47b3'
and '8b5b324a1c2f984ac4755fedfc3bf7a66169a6af' Monotone-Parent: 8284970df75a548f065196f3da7fcd70bc8c47b3 Monotone-Parent: 8b5b324a1c2f984ac4755fedfc3bf7a66169a6af Monotone-Revision: 42650c7e11b236bf9b1b25f7089b591ad1af31aa Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-19T14:44:54 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,20 @@
|
||||
2009-11-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/NSString+Utilities.m (-isJSONString): new utility
|
||||
method that determines whether the current string is a json
|
||||
document.
|
||||
|
||||
* SoObjects/SOGo/NSDictionary+BSJSONAdditions.m
|
||||
(+dictionaryWithJSONString:): this constructor now explicitly
|
||||
returns an NSMutableDictionary to avoid messing with mutable
|
||||
copies and useless allocation/deallocation in the callers.
|
||||
|
||||
* Main/SOGo.m (+initialize): removed the "debugObjectAllocation" global
|
||||
variable since "debugLeaks" has the same meaning. Instantiate a
|
||||
"SOGoStartupLogger" object in order to avoid using NSLog when the
|
||||
parent process is starting, in order to work-around the caching of
|
||||
the pid in NSLog.
|
||||
|
||||
2009-11-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoCache.m: "cache", "users" and "localCache"
|
||||
|
||||
50
Main/SOGo.m
50
Main/SOGo.m
@@ -60,51 +60,56 @@
|
||||
|
||||
#import "SOGo.h"
|
||||
|
||||
@interface SOGoStartupLogger : NSObject
|
||||
@end
|
||||
|
||||
@implementation SOGoStartupLogger
|
||||
@end
|
||||
|
||||
@implementation SOGo
|
||||
|
||||
static unsigned int vMemSizeLimit = 0;
|
||||
static BOOL doCrashOnSessionCreate = NO;
|
||||
static BOOL hasCheckedTables = NO;
|
||||
static BOOL debugRequests = NO;
|
||||
static BOOL debugLeaks = NO;
|
||||
static BOOL useRelativeURLs = NO;
|
||||
|
||||
static BOOL trustProxyAuthentication;
|
||||
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
static BOOL debugObjectAllocation = NO;
|
||||
static BOOL debugLeaks = NO;
|
||||
#endif
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSUserDefaults *ud;
|
||||
SoClassSecurityInfo *sInfo;
|
||||
NSArray *basicRoles;
|
||||
SOGoStartupLogger *logger;
|
||||
id tmp;
|
||||
|
||||
NSLog(@"starting SOGo (build %@)", SOGoBuildDate);
|
||||
logger = [SOGoStartupLogger new];
|
||||
[logger logWithFormat: @"starting SOGo (build %@)", SOGoBuildDate];
|
||||
|
||||
if ([[ud persistentDomainForName: @"sogod"] count] == 0)
|
||||
NSLog(@"WARNING: No configuration found. SOGo will not work properly.");
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
if ([[ud persistentDomainForName: @"sogod"] count] == 0)
|
||||
[logger warnWithFormat: @"No configuration found."
|
||||
@" SOGo will not work properly."];
|
||||
|
||||
doCrashOnSessionCreate = [ud boolForKey:@"SOGoCrashOnSessionCreate"];
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
debugObjectAllocation = [ud boolForKey: @"SOGoDebugObjectAllocation"];
|
||||
if (debugObjectAllocation)
|
||||
{
|
||||
NSLog (@"activating stats on object allocation");
|
||||
GSDebugAllocationActive (YES);
|
||||
}
|
||||
#endif
|
||||
debugRequests = [ud boolForKey: @"SOGoDebugRequests"];
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
debugLeaks = [ud boolForKey: @"SOGoDebugLeaks"];
|
||||
if (debugLeaks)
|
||||
[logger logWithFormat: @"activating leak debugging"];
|
||||
#endif
|
||||
/* vMem size check - default is 384MB */
|
||||
|
||||
|
||||
tmp = [ud objectForKey: @"SxVMemLimit"];
|
||||
vMemSizeLimit = ((tmp != nil) ? [tmp intValue] : 384);
|
||||
if (vMemSizeLimit > 0)
|
||||
NSLog(@"Note: vmem size check enabled: shutting down app when "
|
||||
@"vmem > %d MB", vMemSizeLimit);
|
||||
[logger logWithFormat: @"vmem size check enabled: shutting down app when "
|
||||
@"vmem > %d MB", vMemSizeLimit];
|
||||
#if LIB_FOUNDATION_LIBRARY
|
||||
if ([ud boolForKey:@"SOGoEnableDoubleReleaseCheck"])
|
||||
[NSAutoreleasePool enableDoubleReleaseCheck: YES];
|
||||
@@ -127,6 +132,7 @@ static BOOL debugObjectAllocation = NO;
|
||||
|
||||
trustProxyAuthentication = [ud boolForKey: @"SOGoTrustProxyAuthentication"];
|
||||
useRelativeURLs = [ud boolForKey: @"WOUseRelativeURLs"];
|
||||
[logger release];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
@@ -337,10 +343,6 @@ static BOOL debugObjectAllocation = NO;
|
||||
{
|
||||
id obj;
|
||||
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
if (debugObjectAllocation)
|
||||
NSLog(@"objects allocated\n%s", GSDebugAllocationList (YES));
|
||||
#endif
|
||||
/* put locale info into the context in case it's not there */
|
||||
[self _setupLocaleInContext:_ctx];
|
||||
|
||||
@@ -399,8 +401,6 @@ static BOOL debugObjectAllocation = NO;
|
||||
@"terminating app, vMem size limit (%d MB) has been reached"
|
||||
@" (currently %d MB)",
|
||||
vMemSizeLimit, vmem];
|
||||
// if (debugObjectAllocation)
|
||||
// [self _dumpClassAllocation];
|
||||
[self terminate];
|
||||
}
|
||||
}
|
||||
@@ -421,6 +421,7 @@ static BOOL debugObjectAllocation = NO;
|
||||
}
|
||||
|
||||
cache = [SOGoCache sharedCache];
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
if (debugLeaks)
|
||||
{
|
||||
if (debugOn)
|
||||
@@ -431,6 +432,7 @@ static BOOL debugObjectAllocation = NO;
|
||||
GSDebugAllocationActive (YES);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
resp = [super dispatchRequest: _request];
|
||||
[cache killCache];
|
||||
|
||||
@@ -28,7 +28,7 @@ extern const int jsonDoNotIndent;
|
||||
|
||||
@interface NSDictionary (BSJSONAdditions)
|
||||
|
||||
+ (NSDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
|
||||
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
|
||||
- (NSString *)jsonStringValue;
|
||||
|
||||
@end
|
||||
|
||||
@@ -35,10 +35,10 @@ const int jsonDoNotIndent = -1;
|
||||
|
||||
@implementation NSDictionary (BSJSONAdditions)
|
||||
|
||||
+ (NSDictionary *)dictionaryWithJSONString:(NSString *)jsonString
|
||||
+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString
|
||||
{
|
||||
NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString];
|
||||
NSDictionary *dictionary = nil;
|
||||
NSMutableDictionary *dictionary = nil;
|
||||
[scanner scanJSONObject:&dictionary];
|
||||
[scanner release];
|
||||
return dictionary;
|
||||
|
||||
@@ -45,7 +45,7 @@ extern NSString *jsonNullString;
|
||||
|
||||
@interface NSScanner (PrivateBSJSONAdditions)
|
||||
|
||||
- (BOOL)scanJSONObject:(NSDictionary **)dictionary;
|
||||
- (BOOL)scanJSONObject:(NSMutableDictionary **)dictionary;
|
||||
- (BOOL)scanJSONArray:(NSArray **)array;
|
||||
- (BOOL)scanJSONString:(NSString **)string;
|
||||
- (BOOL)scanJSONValue:(id *)value;
|
||||
|
||||
@@ -48,7 +48,7 @@ NSString *jsonNullString = @"null";
|
||||
|
||||
@implementation NSScanner (PrivateBSJSONAdditions)
|
||||
|
||||
- (BOOL)scanJSONObject:(NSDictionary **)dictionary
|
||||
- (BOOL)scanJSONObject:(NSMutableDictionary **)dictionary
|
||||
{
|
||||
//[self setCharactersToBeSkipped:nil];
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
// LDIF
|
||||
- (BOOL) _isLDIFSafe;
|
||||
|
||||
- (BOOL) isJSONString;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSSTRING_URL_H */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <NGExtensions/NGQuotedPrintableCoding.h>
|
||||
|
||||
#import "NSArray+Utilities.h"
|
||||
#import "NSDictionary+BSJSONAdditions.h"
|
||||
#import "NSDictionary+URL.h"
|
||||
|
||||
#import "NSString+Utilities.h"
|
||||
@@ -422,4 +423,14 @@ static NSMutableCharacterSet *safeLDIFStartChars = nil;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) isJSONString
|
||||
{
|
||||
NSDictionary *jsonData;
|
||||
|
||||
#warning this method is a quick and dirty way of detecting the file-format
|
||||
jsonData = [NSDictionary dictionaryWithJSONString: self];
|
||||
|
||||
return (jsonData != nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -40,3 +40,8 @@ clean ::
|
||||
distclean :: clean
|
||||
|
||||
uninstall ::
|
||||
@if [ -L "$(SOGO_TEMPLATESDIR)" ]; then \
|
||||
echo "$(SOGO_TEMPLATESDIR) is a symbolic link (for development?). Uninstallation skipped."; \
|
||||
else \
|
||||
rm -rf $(SOGO_TEMPLATESDIR); \
|
||||
fi
|
||||
|
||||
@@ -22,3 +22,8 @@ clean ::
|
||||
distclean :: clean
|
||||
|
||||
uninstall ::
|
||||
@if [ -L "$(SOGO_WEBSERVERRESOURCESDIR)" ]; then \
|
||||
echo "$(SOGO_WEBSERVERRESOURCESDIR) is a symbolic link (for development?). Uninstallation skipped."; \
|
||||
else \
|
||||
rm -rf $(SOGO_WEBSERVERRESOURCESDIR); \
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user