From 1c74dab0e786b24dd8cf166a8632f53e4ed737fc Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 19 Oct 2004 15:46:15 +0000 Subject: [PATCH] some work on iCal file git-svn-id: http://svn.opengroupware.org/SOGo/trunk@408 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/Protocols/iCalHTTP/ChangeLog | 4 ++ SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.h | 7 +++ SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.m | 54 +++++++++++++++++++ SOGo/Protocols/iCalHTTP/Version | 2 +- SOGo/Protocols/iCalHTTP/product.plist | 20 ++++++- 5 files changed, 84 insertions(+), 3 deletions(-) diff --git a/SOGo/Protocols/iCalHTTP/ChangeLog b/SOGo/Protocols/iCalHTTP/ChangeLog index d43b56c0..59ecd8c7 100644 --- a/SOGo/Protocols/iCalHTTP/ChangeLog +++ b/SOGo/Protocols/iCalHTTP/ChangeLog @@ -1,3 +1,7 @@ +2004-10-19 Helge Hess + + * SOGoICalHTTPHandler.m: some work on assembly support (v0.9.2) + 2004-10-08 Helge Hess * created ChangeLog diff --git a/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.h b/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.h index 397a43ce..32fef61a 100644 --- a/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.h +++ b/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.h @@ -24,8 +24,15 @@ #import +/* + SOGoICalHTTPHandler + + Object to represent a SOGoAppointmentFolder as a single iCalendar file. +*/ + @interface SOGoICalHTTPHandler : NSObject { + // TODO: remember for ivars: there is _one_ handler per class! Not per ctx! } @end diff --git a/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.m b/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.m index 1ad82b8c..67fd6691 100644 --- a/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.m +++ b/SOGo/Protocols/iCalHTTP/SOGoICalHTTPHandler.m @@ -21,6 +21,7 @@ #include "SOGoICalHTTPHandler.h" #include "common.h" +#include @implementation SOGoICalHTTPHandler @@ -28,4 +29,57 @@ [super dealloc]; } +/* context */ + +- (WOContext *)context { + return [[WOApplication application] context]; +} + +/* clientObject */ + +- (id)clientObjectInContext:(id)_ctx { + /* + The handler object is _not_ a method, its just a regular object + itself! (because methods are defined on it). + */ + NSArray *stack; + + stack = [_ctx objectTraversalStack]; + if ([stack count] == 0) { + [self logWithFormat:@"ERROR: no objects in traversal stack: %@", _ctx]; + return nil; + } + if ([stack count] < 2) { + [self logWithFormat:@"ERROR: not enough objects in traversal stack: %@", + stack]; + return nil; + } + + if ([stack lastObject] != self) // TODO: hm, hm, not really OK + return [stack lastObject]; + + return [stack objectAtIndex:[stack count] - 2]; +} + +/* fetching */ + +- (NSArray *)storedNamesInContext:(id)_ctx { + /* the client object will cache the names */ + return [[self clientObjectInContext:_ctx] toOneRelationshipKeys]; +} + +/* actions */ + +- (id)assembleEventsInContext:(id)_ctx { + [self logWithFormat:@"assemble iCal events ..."]; + [self logWithFormat:@" names: %@", [self storedNamesInContext:_ctx]]; + return self; +} + +- (id)updateEventsInContext:(id)_ctx { + [self logWithFormat:@"updates iCal events from a full collection ..."]; + return [NSException exceptionWithHTTPStatus:501 /* Not Implemented */ + reason:@"please use WebDAV for modifications!"]; +} + @end /* SOGoICalHTTPHandler */ diff --git a/SOGo/Protocols/iCalHTTP/Version b/SOGo/Protocols/iCalHTTP/Version index 36842fc5..bbf7bd63 100644 --- a/SOGo/Protocols/iCalHTTP/Version +++ b/SOGo/Protocols/iCalHTTP/Version @@ -1,3 +1,3 @@ # $Id: Version 368 2004-10-06 19:28:12Z znek $ -SUBMINOR_VERSION:=1 +SUBMINOR_VERSION:=2 diff --git a/SOGo/Protocols/iCalHTTP/product.plist b/SOGo/Protocols/iCalHTTP/product.plist index cd9ca91f..51e2e8cc 100644 --- a/SOGo/Protocols/iCalHTTP/product.plist +++ b/SOGo/Protocols/iCalHTTP/product.plist @@ -9,8 +9,24 @@ classes = { SOGoICalHTTPHandler = { - superclass = "NSObject"; - protectedBy = "View"; + superclass = "NSObject"; + protectedBy = "View"; + methods = { + GET = { + protectedBy = "View"; + selector = { + name = "assembleEventsInContext:"; + addContextParameter = YES; + }; + }; + PUT = { + protectedBy = "View"; + selector = { + name = "updateEventsInContext:"; + addContextParameter = YES; + }; + }; + }; }; }; -- 2.39.5