From: helge Date: Wed, 30 Jun 2004 11:57:37 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/trunk@115 d1b88da0-ebda-0310-925b-ed51d... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a26da006ed7b2a6b31c272f090b5e8d6daccd40;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/trunk@115 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/OGoContentStore/ChangeLog b/OGoContentStore/ChangeLog index 96c1bc14..197bb36b 100644 --- a/OGoContentStore/ChangeLog +++ b/OGoContentStore/ChangeLog @@ -1,5 +1,8 @@ 2004-06-30 Helge Hess + * GNUmakefile (libOGoContentStore_HEADER_FILES_INSTALL_DIR): install + headers in OGoContentStore + * GNUmakefile.preamble (ocs_ls_TOOL_LIBS): added static dependencies for OSX diff --git a/OGoContentStore/GNUmakefile b/OGoContentStore/GNUmakefile index 4f71ff72..5e9c0651 100644 --- a/OGoContentStore/GNUmakefile +++ b/OGoContentStore/GNUmakefile @@ -6,6 +6,9 @@ include ./Version LIBRARY_NAME = libOGoContentStore TOOL_NAME = ocs_ls ocs_mkdir ocs_cat +libOGoContentStore_HEADER_FILES_DIR = . +libOGoContentStore_HEADER_FILES_INSTALL_DIR = /OGoContentStore + libOGoContentStore_HEADER_FILES += \ NSURL+OCS.h \ EOAdaptorChannel+OCS.h \ diff --git a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m index 9182664a..83162aca 100644 --- a/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -31,14 +31,37 @@ /* name lookup */ +- (BOOL)isValidAppointmentName:(NSString *)_key { + if ([_key length] == 0) + return NO; + + return YES; +} + +- (id)appointmentWithName:(NSString *)_key inContext:(id)_ctx { + static Class aptClass = Nil; + id apt; + + if (aptClass == Nil) + aptClass = NSClassFromString(@"SOGoAppointmentObject"); + if (aptClass == Nil) { + [self logWithFormat:@"ERROR: missing SOGoAppointmentObject class!"]; + return nil; + } + + apt = [[aptClass alloc] initWithName:_key inContainer:self]; + return [apt 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; - - [self logWithFormat:@"CHECK KEY: %@", _key]; + + if ([self isValidAppointmentName:_key]) + return [self appointmentWithName:_key inContext:_ctx]; /* return 404 to stop acquisition */ return [NSException exceptionWithHTTPStatus:404 /* Not Found */]; diff --git a/SOGo/SoObjects/SOGo/SOGoContentObject.h b/SOGo/SoObjects/SOGo/SOGoContentObject.h index 2f8d7f2f..d86fa826 100644 --- a/SOGo/SoObjects/SOGo/SOGoContentObject.h +++ b/SOGo/SoObjects/SOGo/SOGoContentObject.h @@ -25,6 +25,8 @@ #include +@class NSString; + @interface SOGoContentObject : SOGoObject { NSString *ocsPath; @@ -35,6 +37,10 @@ - (void)setOCSPath:(NSString *)_path; - (NSString *)ocsPath; +- (NSString *)ocsPathOfContainer; + +- (OCSFolder *)ocsFolder; + @end #endif /* __SOGo_SOGoContentObject_H__ */ diff --git a/SOGo/SoObjects/SOGo/SOGoContentObject.m b/SOGo/SoObjects/SOGo/SOGoContentObject.m index c29c4391..c5ec77af 100644 --- a/SOGo/SoObjects/SOGo/SOGoContentObject.m +++ b/SOGo/SoObjects/SOGo/SOGoContentObject.m @@ -45,10 +45,34 @@ ASSIGNCOPY(self->ocsPath, _path); } + - (NSString *)ocsPath { + if (self->ocsPath == nil) { + NSString *p; + + if ((p = [self ocsPathOfContainer]) != nil) { + if (![p hasSuffix:@"/"]) p = [p stringByAppendingString:@"/"]; + p = [p stringByAppendingString:[self nameInContainer]]; + self->ocsPath = [p copy]; + } + } return self->ocsPath; } +- (NSString *)ocsPathOfContainer { + if (![[self container] respondsToSelector:@selector(ocsPath)]) + return nil; + + return [[self container] ocsPath]; +} + +- (OCSFolder *)ocsFolder { + if (![[self container] respondsToSelector:@selector(ocsFolder)]) + return nil; + + return [[self container] ocsFolder]; +} + /* description */ - (void)appendAttributesToDescription:(NSMutableString *)_ms { diff --git a/SOGo/SoObjects/SOGo/SOGoFolder.h b/SOGo/SoObjects/SOGo/SOGoFolder.h index c62459f2..912fadd2 100644 --- a/SOGo/SoObjects/SOGo/SOGoFolder.h +++ b/SOGo/SoObjects/SOGo/SOGoFolder.h @@ -25,6 +25,8 @@ #include +@class OCSFolder; + @interface SOGoFolder : SOGoObject { NSString *ocsPath; @@ -35,6 +37,8 @@ - (void)setOCSPath:(NSString *)_Path; - (NSString *)ocsPath; +- (OCSFolder *)ocsFolder; + @end #endif /* __SOGo_SOGoFolder_H__ */ diff --git a/SOGo/SoObjects/SOGo/SOGoFolder.m b/SOGo/SoObjects/SOGo/SOGoFolder.m index a0ef5b14..c40c45e8 100644 --- a/SOGo/SoObjects/SOGo/SOGoFolder.m +++ b/SOGo/SoObjects/SOGo/SOGoFolder.m @@ -22,11 +22,14 @@ #include "SOGoFolder.h" #include "common.h" +#include +#include @implementation SOGoFolder - (void)dealloc { - [self->ocsPath release]; + [self->ocsFolder release]; + [self->ocsPath release]; [super dealloc]; } @@ -49,6 +52,18 @@ return self->ocsPath; } +- (OCSFolderManager *)folderManager { + return [OCSFolderManager defaultFolderManager]; +} +- (OCSFolder *)ocsFolder { + if (self->ocsFolder != nil) + return [self->ocsFolder isNotNull] ? self->ocsFolder : nil; + + self->ocsFolder = + [[[self folderManager] folderAtPath:[self ocsPath]] retain]; + return self->ocsFolder; +} + /* description */ - (void)appendAttributesToDescription:(NSMutableString *)_ms { diff --git a/SOGo/SoObjects/SOGo/SOGoUserFolder.m b/SOGo/SoObjects/SOGo/SOGoUserFolder.m index b8dd3478..f67aab94 100644 --- a/SOGo/SoObjects/SOGo/SOGoUserFolder.m +++ b/SOGo/SoObjects/SOGo/SOGoUserFolder.m @@ -68,7 +68,7 @@ if (calClass == Nil) calClass = NSClassFromString(@"SOGoAppointmentFolder"); if (calClass == Nil) { - [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder!"]; + [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder class!"]; return nil; }