See ChangeLog

Monotone-Parent: 1e01e7055612c8aa2f2c0e9151035ef348604b8e
Monotone-Revision: ab8b4a7a66ffdb6688f466f2cc301caf1fc40a66

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2010-09-24T19:13:02
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2010-09-24 19:13:02 +00:00
parent 38af9bc66b
commit 3d2f08f678
25 changed files with 1 additions and 1485 deletions
-6
View File
@@ -11,9 +11,6 @@ SOGo_INSTALL_DIR = $(SOGO_LIBDIR)
SOGo_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
# SOGoCustomGroupFolder.h \
# SOGoGroupsFolder.h \
# SOGoGroupFolder.h
SOGo_HEADER_FILES = \
SOGoBuild.h \
SOGoProductLoader.h \
@@ -72,9 +69,6 @@ SOGo_HEADER_FILES = \
all::
@touch SOGoBuild.m
# SOGoCustomGroupFolder.m \
# SOGoGroupsFolder.m \
# SOGoGroupFolder.m
SOGo_OBJC_FILES = \
SOGoBuild.m \
SOGoProductLoader.m \
-22
View File
@@ -1,22 +0,0 @@
libSOGo
=======
Common SOGo objects.
NOTE: the SOPE objects are registered by the Main bundle products.plist.
Class Hierarchy
===============
[NSObject]
SOGoObject
SOGoContentObject
SOGoFolder
SOGoUserFolder - the "home" directory
SOGoGroupsFolder - intermediate folder
SOGoGroupFolder - a folder representing a set of people
SOGoCustomGroupFolder - a custom group (eg '_custom_helge,znek')
TODO
====
- why is SOGoUserFolder an OCS folder?
-59
View File
@@ -1,59 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: SOGoCustomGroupFolder.h 107 2004-06-30 10:26:46Z helge $
#ifndef __SOGo_SOGoCustomGroupFolder_H__
#define __SOGo_SOGoCustomGroupFolder_H__
#include <SOGo/SOGoGroupFolder.h>
/*
SOGoCustomGroupFolder
same parent/child like SOGoGroupFolder
Note: parent folder can be different if instantiated for internal use.
Note: you can use this folder for internal handling of groups! Eg aggregate
Calendar fetches.
This is a specific group folder for 'custom' groups. Group members are
currently encoded as the folder name in the URL like
_custom_znek,helge
*/
@class NSArray;
@interface SOGoCustomGroupFolder : SOGoGroupFolder
{
NSArray *uids;
}
- (id)initWithUIDs:(NSArray *)_uids inContainer:(id)_container;
/* accessors */
- (NSArray *)uids;
/* pathes */
@end
#endif /* __SOGo_SOGoCustomGroupFolder_H__ */
-111
View File
@@ -1,111 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <NGExtensions/NSObject+Logs.h>
#import "SOGoCustomGroupFolder.h"
@implementation SOGoCustomGroupFolder
static NSString *SOGoUIDSeparator = @",";
- (id)initWithUIDs:(NSArray *)_uids inContainer:(id)_container {
if ((self = [self initWithName:nil inContainer:_container])) {
self->uids = [_uids copy];
}
return self;
}
- (void)dealloc {
[self->uids release];
[super dealloc];
}
/* accessors */
- (NSArray *)unescapeURLComponents:(NSArray *)_parts {
// #warning TODO: implement URL UID unescaping if necessary
// TODO: who calls this for what?
// Note: remember URL encoding!
return _parts;
}
- (NSArray *)uids {
NSArray *a;
NSString *s;
if (self->uids != nil)
return self->uids;
s = [self nameInContainer];
if (![s hasPrefix:@"_custom_"]) {
[self logWithFormat:@"WARNING: incorrect custom group folder name: '%@'",
s];
return nil;
}
s = [s substringFromIndex:8];
a = [s componentsSeparatedByString:SOGoUIDSeparator];
a = [self unescapeURLComponents:a];
self->uids = [a copy];
if ([self->uids count] < 2)
[self debugWithFormat:@"Note: less than two custom group members!"];
return self->uids;
}
/* display name */
- (NSString *)davDisplayName {
NSArray *a;
unsigned count;
a = [self uids];
if ((count = [a count]) == 0)
return @"empty";
if (count == 1)
return [a objectAtIndex:0];
if (count < 6) {
NSMutableString *ms;
unsigned i;
ms = [NSMutableString stringWithCapacity:64];
for (i = 0; i < count; i++) {
if (i != 0) [ms appendString:@"|"];
[ms appendString:[a objectAtIndex:i]];
if ([ms length] > 60) {
ms = nil;
break;
}
}
if (ms != nil) return ms;
}
// TODO: localize 'members' (UI component task?)
return [NSString stringWithFormat:@"Members: %d", count];
}
@end /* SOGoCustomGroupFolder */
-58
View File
@@ -1,58 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: SOGoGroupFolder.h 107 2004-06-30 10:26:46Z helge $
#ifndef __SOGo_SOGoGroupFolder_H__
#define __SOGo_SOGoGroupFolder_H__
#include <SOGo/SOGoObject.h>
/*
SOGoGroupFolder
Parent object: the SOGoGroupsFolder
Child objects:
*/
@class NSArray, NSDictionary;
@interface SOGoGroupFolder : SOGoObject
{
NSDictionary *uidToFolder;
NSArray *folders;
}
/* accessors */
- (NSArray *)uids;
/* folder management */
- (NSArray *)memberFolders;
- (id)folderForUID:(NSString *)_uid;
- (void)resetFolderCaches;
- (void)sleep;
/* pathes */
@end
#endif /* __SOGo_SOGoGroupFolder_H__ */
-225
View File
@@ -1,225 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGExtensions/NGLogger.h>
#import <NGExtensions/NGLoggerManager.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSNull+misc.h>
#import "SOGoGroupFolder.h"
@implementation SOGoGroupFolder
static NGLogger *logger = nil;
+ (void) initialize
{
NGLoggerManager *lm;
if (!logger)
{
lm = [NGLoggerManager defaultLoggerManager];
logger = [lm loggerForDefaultKey:@"SOGoGroupFolderDebugEnabled"];
}
}
- (void) dealloc
{
[uidToFolder release];
[folders release];
[super dealloc];
}
/* logging */
- (id)debugLogger {
return logger;
}
/* accessors */
- (NSArray *)uids {
[self errorWithFormat:@"instantiated abstract Group folder class!"];
return nil;
}
/* folder management */
- (id)_primaryLookupFolderForUID:(NSString *)_uid inContext:(id)_ctx {
NSException *error = nil;
NSArray *path;
id ctx, result;
/* create subcontext, so that we don't destroy our environment */
if ((ctx = [_ctx createSubContext]) == nil) {
[self errorWithFormat:@"could not create SOPE subcontext!"];
return nil;
}
/* build path */
path = _uid != nil ? [NSArray arrayWithObjects:&_uid count:1] : nil;
/* traverse path */
result = [[ctx application] traversePathArray:path inContext:ctx
error:&error acquire:NO];
if (error != nil) {
[self errorWithFormat:@"folder lookup failed (uid=%@): %@",
_uid, error];
return nil;
}
if (logger)
[self debugWithFormat:@"Note: got folder for uid %@ path %@: %@",
_uid, [path componentsJoinedByString:@"=>"], result];
return result;
}
- (void)_setupFolders {
NSMutableDictionary *md;
NSMutableArray *ma;
NSArray *luids;
unsigned i, count;
if (uidToFolder != nil)
return;
if ((luids = [self uids]) == nil)
return;
#warning we should populate "uidToFolder" directly
count = [luids count];
ma = [NSMutableArray arrayWithCapacity:count + 1];
md = [NSMutableDictionary dictionaryWithCapacity:count];
for (i = 0; i < count; i++) {
NSString *uid;
id folder;
uid = [luids objectAtIndex:i];
folder = [self _primaryLookupFolderForUID:uid inContext: context];
if ([folder isNotNull]) {
[md setObject:folder forKey:uid];
[ma addObject:folder];
}
else
[ma addObject:[NSNull null]];
}
/* fix results */
uidToFolder = [md copy];
folders = [[NSArray alloc] initWithArray:ma];
}
- (NSArray *)memberFolders {
[self _setupFolders];
return folders;
}
- (id)folderForUID:(NSString *)_uid {
[self _setupFolders];
if ([_uid length] == 0)
return nil;
return [uidToFolder objectForKey:_uid];
}
- (void) resetFolderCaches
{
[uidToFolder release];
uidToFolder = nil;
[folders release];
folders = nil;
}
- (void) sleep
{
[self resetFolderCaches];
[super sleep];
}
/* SOPE */
- (BOOL) isFolderish
{
return YES;
}
/* looking up shared objects */
- (SOGoGroupsFolder *) lookupGroupsFolder
{
return [[self container] lookupGroupsFolder];
}
/* pathes */
/* name lookup */
- (id) groupCalendar: (NSString *) _key
inContext: (id) _ctx
{
static Class calClass = Nil;
id calendar;
if (calClass == Nil)
calClass = NSClassFromString(@"SOGoGroupAppointmentFolder");
if (calClass == Nil) {
[self errorWithFormat:@"missing SOGoGroupAppointmentFolder class!"];
return nil;
}
calendar = [[calClass alloc] initWithName:_key inContainer:self];
// TODO: should we pass over the uids in questions or should the
// appointment folder query its container for that info?
return [calendar autorelease];
}
- (id) lookupName: (NSString *) _key
inContext: (id) _ctx
acquire: (BOOL) _flag
{
id obj;
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
return obj;
if ([_key isEqualToString:@"Calendar"])
return [self groupCalendar:_key inContext:_ctx];
/* return 404 to stop acquisition */
return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
}
@end /* SOGoGroupFolder */
-59
View File
@@ -1,59 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: SOGoGroupsFolder.h 107 2004-06-30 10:26:46Z helge $
#ifndef __SOGo_SOGoGroupsFolder_H__
#define __SOGo_SOGoGroupsFolder_H__
#include <SOGo/SOGoObject.h>
/*
SOGoGroupsFolder
Parent object: the SOGoUserFolder
Child objects: SOGoGroupFolder objects
'_custom_*': SOGoCustomGroupFolder
This object represents a collection of groups, its the "Groups" in such a
path:
/SOGo/so/znek/Groups/sales
It also acts as a factory for the proper group folders, eg "custom" groups
(arbitary person collections) or later on cookie based configured groups or
groups stored in LDAP.
*/
@class NSString;
@interface SOGoGroupsFolder : SOGoObject
{
}
/* accessors */
/* looking up shared objects */
- (SOGoGroupsFolder *)lookupGroupsFolder;
/* pathes */
@end
#endif /* __SOGo_SOGoGroupsFolder_H__ */
-91
View File
@@ -1,91 +0,0 @@
/*
Copyright (C) 2004 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#import <NGObjWeb/NSException+HTTP.h>
#import <NGExtensions/NSObject+Logs.h>
#import "SOGoGroupsFolder.h"
@implementation SOGoGroupsFolder
// - (void)dealloc {
// [super dealloc];
// }
/* accessors */
/* SOPE */
- (BOOL) isFolderish
{
return YES;
}
/* looking up shared objects */
- (SOGoGroupsFolder *) lookupGroupsFolder
{
return self;
}
/* pathes */
/* name lookup */
- (id) customGroup: (NSString *) _key
inContext: (id) _ctx
{
static Class groupClass = Nil;
id group;
if (!groupClass)
groupClass = NSClassFromString(@"SOGoCustomGroupFolder");
if (!groupClass)
{
[self logWithFormat:@"ERROR: missing SOGoCustomGroupFolder class!"];
group = nil;
}
else
group = [groupClass objectWithName: _key inContainer: self];
return group;
}
- (id) lookupName: (NSString *) _key
inContext: (id) _ctx
acquire: (BOOL) _flag
{
id obj;
/* first check attributes directly bound to the application */
obj = [super lookupName: _key inContext: _ctx acquire: NO];
if (!obj)
{
if ([_key hasPrefix: @"_custom_"])
obj = [self customGroup: _key inContext: _ctx];
else
obj = [NSException exceptionWithHTTPStatus:404 /* Not Found */];
}
return obj;
}
@end /* SOGoGroupsFolder */
-5
View File
@@ -324,11 +324,6 @@
return [container lookupUserFolder];
}
// - (SOGoGroupsFolder *) lookupGroupsFolder
// {
// return [[self lookupUserFolder] lookupGroupsFolder];
// }
- (void) sleep
{
if ([self doesRetainContainer])
-1
View File
@@ -28,7 +28,6 @@
SOGoUserFolder
Parent object: the root object (SoApplication object)
Child objects:
'Groups': SOGoGroupsFolder
'Calendar': SOGoAppointmentFolder
The SOGoUserFolder is the "home directory" of the user where all his