mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 09:48:51 +00:00
Monotone-Parent: f2b7fe7c387ac36654ad3e24e68362b3a0a3f2c8
Monotone-Revision: 99c41084c35e71bdf38a8a88897a9ad24b1c0903 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-19T16:31:03 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
121
Main/SOGo.m
121
Main/SOGo.m
@@ -19,9 +19,13 @@
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
// #import <Foundation/NSAutoreleasePool.h>
|
||||
// #import <Foundation/NSArray.h>
|
||||
|
||||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDate.h>
|
||||
// #import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
#import <Foundation/NSRunLoop.h>
|
||||
@@ -57,6 +61,102 @@
|
||||
#import "SOGoProductLoader.h"
|
||||
#import "NSException+Stacktrace.h"
|
||||
|
||||
// static NSMutableDictionary *debugCache = nil;
|
||||
|
||||
// static NSMutableArray *debugCache = nil;
|
||||
|
||||
// @interface GSMutableArray : NSArray;
|
||||
// @end
|
||||
|
||||
// @interface GSMutableArray (sogodebug)
|
||||
// @end
|
||||
|
||||
// @implementation GSMutableArray (sogodebug)
|
||||
|
||||
// + (id) alloc
|
||||
// {
|
||||
// static BOOL avoid = NO;
|
||||
// id newInst;
|
||||
|
||||
// newInst = [super alloc];
|
||||
// if (!avoid)
|
||||
// {
|
||||
// avoid = YES;
|
||||
// if (!debugCache)
|
||||
// debugCache = [NSMutableArray new];
|
||||
// [debugCache addObject: [NSValue valueWithPointer: newInst]];
|
||||
// }
|
||||
|
||||
// return newInst;
|
||||
// }
|
||||
|
||||
// - (id) retain
|
||||
// {
|
||||
// NSNumber *nbr;
|
||||
// id this;
|
||||
// static BOOL avoid = NO;
|
||||
|
||||
// fprintf (stderr, "retain start (%p)\n", self);
|
||||
|
||||
// if (avoid)
|
||||
// this = [super retain];
|
||||
// else
|
||||
// {
|
||||
// avoid = YES;
|
||||
// if (!debugCache)
|
||||
// debugCache = [NSMutableArray new];
|
||||
// nbr = [debugCache objectForKey: self];
|
||||
// nbr = [NSNumber numberWithInt: ([nbr intValue] + 1)];
|
||||
// [debugCache setObject: nbr forKey: self];
|
||||
// this = [super retain];
|
||||
// avoid = NO;
|
||||
// }
|
||||
|
||||
// fprintf (stderr, "retain stop (%p)\n", self);
|
||||
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// - (void) release
|
||||
// {
|
||||
// NSNumber *nbr;
|
||||
// int count;
|
||||
// static BOOL avoid = NO;
|
||||
|
||||
// fprintf (stderr, "release start (%p)\n", self);
|
||||
|
||||
// if (avoid)
|
||||
// [super release];
|
||||
// else
|
||||
// {
|
||||
// avoid = YES;
|
||||
|
||||
// nbr = [debugCache objectForKey: self];
|
||||
// if (nbr)
|
||||
// {
|
||||
// count = [nbr intValue];
|
||||
// if (count == 2)
|
||||
// {
|
||||
// [debugCache removeObjectForKey: self];
|
||||
// fprintf (stderr, "removing object\n");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nbr = [NSNumber numberWithInt: (count - 1)];
|
||||
// [debugCache setObject: nbr forKey: self];
|
||||
// fprintf (stderr, "decrementing counter\n");
|
||||
// }
|
||||
// }
|
||||
// [super release];
|
||||
|
||||
// avoid = NO;
|
||||
// }
|
||||
|
||||
// fprintf (stderr, "release stop (%p)\n", self);
|
||||
// }
|
||||
|
||||
// @end
|
||||
|
||||
@interface SOGo : SoApplication
|
||||
{
|
||||
NSMutableDictionary *localeLUT;
|
||||
@@ -230,6 +330,10 @@ static BOOL debugObjectAllocation = NO;
|
||||
NSUserDefaults *ud;
|
||||
BOOL ok;
|
||||
|
||||
#if 0
|
||||
return YES;
|
||||
#endif
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
ok = YES;
|
||||
cm = [GCSChannelManager defaultChannelManager];
|
||||
@@ -342,7 +446,7 @@ static BOOL debugObjectAllocation = NO;
|
||||
#endif
|
||||
/* put locale info into the context in case it's not there */
|
||||
[self _setupLocaleInContext:_ctx];
|
||||
|
||||
|
||||
/* first check attributes directly bound to the application */
|
||||
obj = [super lookupName:_key inContext:_ctx acquire:_flag];
|
||||
if (!obj)
|
||||
@@ -357,6 +461,7 @@ static BOOL debugObjectAllocation = NO;
|
||||
|
||||
if (![_key isEqualToString:@"favicon.ico"])
|
||||
{
|
||||
// NSLog (@"lookup user name '%@'", _key);
|
||||
if ([self isUserName: _key inContext: _ctx])
|
||||
obj = [self lookupUser: _key inContext: _ctx];
|
||||
}
|
||||
@@ -411,6 +516,8 @@ static BOOL debugObjectAllocation = NO;
|
||||
WOResponse *resp;
|
||||
NSDate *startDate, *endDate;
|
||||
|
||||
// NSAutoreleasePool *pool;
|
||||
|
||||
if (debugRequests)
|
||||
{
|
||||
[self logWithFormat: @"starting method '%@' on uri '%@'",
|
||||
@@ -418,10 +525,22 @@ static BOOL debugObjectAllocation = NO;
|
||||
startDate = [NSDate date];
|
||||
}
|
||||
|
||||
// GSDebugAllocationActive (YES);
|
||||
// GSDebugAllocationList (NO);
|
||||
|
||||
// pool = [NSAutoreleasePool new];
|
||||
|
||||
cache = [SOGoCache sharedCache];
|
||||
resp = [super dispatchRequest: _request];
|
||||
[SOGoCache killCache];
|
||||
|
||||
// [resp retain];
|
||||
// [pool release];
|
||||
// [resp autorelease];
|
||||
|
||||
// NSLog (@"objects:\n%s\n", GSDebugAllocationList (YES));
|
||||
// GSDebugAllocationActive (NO);
|
||||
|
||||
if (debugRequests)
|
||||
{
|
||||
endDate = [NSDate date];
|
||||
|
||||
@@ -1791,6 +1791,12 @@ static Class sogoAppointmentFolderKlass = Nil;
|
||||
NSString *url;
|
||||
BOOL handledLater;
|
||||
|
||||
#if 0
|
||||
obj = [SOGoAppointmentObject objectWithName: _key
|
||||
inContainer: self];
|
||||
return obj;
|
||||
#endif
|
||||
|
||||
/* first check attributes directly bound to the application */
|
||||
handledLater = [self requestNamedIsHandledLater: _key];
|
||||
if (handledLater)
|
||||
|
||||
@@ -320,6 +320,24 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
|
||||
{
|
||||
NSString *secureContent;
|
||||
|
||||
#if 0
|
||||
return (@"BEGIN:VCALENDAR\r\n"
|
||||
@"VERSION:2.0\r\n"
|
||||
@"PRODID:-//Inverse inc.//SOGo0.9//EN\r\n"
|
||||
@"BEGIN:VEVENT\r\n"
|
||||
@"UID:3185-492B0B80-5-BA4E3100\r\n"
|
||||
@"SUMMARY:test event\r\n"
|
||||
@"CREATED:20081124T201510Z\r\n"
|
||||
@"DTSTAMP:20081124T201510Z\r\n"
|
||||
@"LAST-MODIFIED:20081126T015646Z\r\n"
|
||||
@"DTSTART:20081127T150000Z\r\n"
|
||||
@"DTEND:20081127T160000Z\r\n"
|
||||
@"TRANSP:OPAQUE\r\n"
|
||||
@"RRULE:INTERVAL=1;FREQ=WEEKLY\r\n"
|
||||
@"END:VEVENT\r\n"
|
||||
@"END:VCALENDAR");
|
||||
#endif
|
||||
|
||||
if ([[context request] isSoWebDAVRequest])
|
||||
secureContent = [self secureContentAsString];
|
||||
else
|
||||
|
||||
@@ -317,6 +317,10 @@ static NSLock *lock = nil;
|
||||
NSMutableDictionary *currentUser;
|
||||
NSString *dictPassword;
|
||||
|
||||
#if 0
|
||||
return YES;
|
||||
#endif
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
[lock lock];
|
||||
#endif
|
||||
|
||||
@@ -282,6 +282,9 @@ static NSArray *childRecordFields = nil;
|
||||
{
|
||||
static GCSFolderManager *folderManager = nil;
|
||||
|
||||
#if 0
|
||||
return nil;
|
||||
#endif
|
||||
if (!folderManager)
|
||||
folderManager = [GCSFolderManager defaultFolderManager];
|
||||
|
||||
@@ -290,6 +293,10 @@ static NSArray *childRecordFields = nil;
|
||||
|
||||
- (GCSFolder *) ocsFolderForPath: (NSString *) _path
|
||||
{
|
||||
#if 0
|
||||
return nil;
|
||||
#endif
|
||||
|
||||
return [[self folderManager] folderAtPath: _path];
|
||||
}
|
||||
|
||||
@@ -352,6 +359,10 @@ static NSArray *childRecordFields = nil;
|
||||
GCSFolder *folder;
|
||||
NSString *userLogin;
|
||||
|
||||
#if 0
|
||||
return nil;
|
||||
#endif
|
||||
|
||||
if (!ocsFolder)
|
||||
{
|
||||
ocsFolder = [self ocsFolderForPath: [self ocsPath]];
|
||||
|
||||
@@ -202,6 +202,10 @@ static SoSecurityManager *sm = nil;
|
||||
NSURL *folderLocation;
|
||||
NSString *sql, *gcsFolderType;
|
||||
|
||||
#if 0
|
||||
return;
|
||||
#endif
|
||||
|
||||
cm = [GCSChannelManager defaultChannelManager];
|
||||
folderLocation
|
||||
= [[GCSFolderManager defaultFolderManager] folderInfoLocation];
|
||||
@@ -323,6 +327,20 @@ static SoSecurityManager *sm = nil;
|
||||
if (!subFolders)
|
||||
{
|
||||
subFolders = [NSMutableDictionary new];
|
||||
|
||||
#if 0
|
||||
SOGoGCSFolder *folder;
|
||||
if (!subFolderClass)
|
||||
subFolderClass = [[self class] subFolderClass];
|
||||
|
||||
folder = [subFolderClass objectWithName: @"personal" inContainer: self];
|
||||
[folder setDisplayName: [self defaultFolderName]];
|
||||
[folder
|
||||
setOCSPath: [NSString stringWithFormat: @"%@/personal", OCSPath]];
|
||||
[subFolders setObject: folder forKey: @"personal"];
|
||||
return;
|
||||
#endif
|
||||
|
||||
[self appendPersonalSources];
|
||||
[self appendSystemSources];
|
||||
login = [[context activeUser] login];
|
||||
|
||||
@@ -244,17 +244,17 @@ _timeValue (NSString *key)
|
||||
LDAPUserManager *um;
|
||||
NSString *realUID;
|
||||
|
||||
if (// acceptAnyUser
|
||||
// ||
|
||||
[newLogin isEqualToString: @"anonymous"]
|
||||
|| [newLogin isEqualToString: @"freebusy"])
|
||||
realUID = newLogin;
|
||||
else
|
||||
{
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin]
|
||||
objectForKey: @"c_uid"];
|
||||
}
|
||||
// if (// acceptAnyUser
|
||||
// // ||
|
||||
// [newLogin isEqualToString: @"anonymous"]
|
||||
// || [newLogin isEqualToString: @"freebusy"])
|
||||
// realUID = newLogin;
|
||||
// else
|
||||
// {
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin]
|
||||
objectForKey: @"c_uid"];
|
||||
// }
|
||||
|
||||
if ([realUID length])
|
||||
{
|
||||
@@ -320,12 +320,19 @@ _timeValue (NSString *key)
|
||||
|
||||
- (void) _fetchAllEmails
|
||||
{
|
||||
#if 0
|
||||
allEmails = [NSArray arrayWithObject: @"wsourdeau@inverse.ca"];
|
||||
#else
|
||||
allEmails = [self _fetchFieldForUser: @"emails"];
|
||||
#endif
|
||||
[allEmails retain];
|
||||
}
|
||||
|
||||
- (void) _fetchCN
|
||||
{
|
||||
#if 0
|
||||
return @"Wolfgang Sourdeau";
|
||||
#endif
|
||||
cn = [self _fetchFieldForUser: @"cn"];
|
||||
[cn retain];
|
||||
}
|
||||
@@ -517,6 +524,7 @@ _timeValue (NSString *key)
|
||||
|
||||
- (NSString *) language
|
||||
{
|
||||
return @"English";
|
||||
if (!language)
|
||||
{
|
||||
language = [[self userDefaults] stringForKey: @"Language"];
|
||||
@@ -532,6 +540,10 @@ _timeValue (NSString *key)
|
||||
{
|
||||
NSString *timeZoneName;
|
||||
|
||||
#if 0
|
||||
return @"UTC";
|
||||
#endif
|
||||
|
||||
if (!userTimeZone)
|
||||
{
|
||||
timeZoneName = [[self userDefaults] stringForKey: @"TimeZone"];
|
||||
@@ -958,6 +970,10 @@ _timeValue (NSString *key)
|
||||
{
|
||||
NSString *accessValue;
|
||||
|
||||
#if 0
|
||||
return YES;
|
||||
#endif
|
||||
|
||||
accessValue = [self _fetchFieldForUser:
|
||||
[NSString stringWithFormat: @"%@Access", module]];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user