From 2edfcaa0f20c7e9bcdab418df508f56bd1a6787f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sun, 22 Jul 2007 20:40:34 +0000 Subject: [PATCH] Monotone-Parent: 4198b7cec911933d302e467416f80df87577acdb Monotone-Revision: a7a7371747e1185b197e3a0ea0c6d585bf7e0a46 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-22T20:40:34 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 +++++++ SoObjects/SOGo/SOGoFolder.h | 3 +++ SoObjects/SOGo/SOGoFolder.m | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index c2e4d3118..5a69d879a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-07-22 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -davNamespaces]): new + optional method for subclasses which handle specific extensions to + the DAV protocol: CardDAV or CalDAV. + ([SOGoFolder + -lookupName:lookupNameinContext:localContextacquire:acquire]): + new overriden method that handles dav invocations for extensions + to DAV by returning an appropriate SoSelectorInvocation. + * SoObjects/SOGo/NSString+Utilities.m ([NSString -asDavInvocation]): new method returning a dictionary with a "ns" key representing the dav namespace and a "method" key representing diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index f4263b69b..5358299d3 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -73,6 +73,9 @@ - (BOOL) create; - (NSException *) delete; +/* dav */ +- (NSArray *) davNamespaces; + /* acls as a container */ - (NSArray *) aclUsersForObjectAtPath: (NSArray *) objectPathArray; - (NSArray *) aclsForUser: (NSString *) uid diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 530a0e0ef..5b6f5d2c2 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -28,6 +28,8 @@ #import #import +#import +#import #import #import #import @@ -38,6 +40,8 @@ #import #import +#import "NSString+Utilities.h" + #import "SOGoPermissions.h" #import "SOGoUser.h" @@ -523,8 +527,48 @@ static NSString *defaultUserID = @""; return [[self davURL] absoluteString]; } +- (id) lookupName: (NSString *) lookupName + inContext: (id) localContext + acquire: (BOOL) acquire +{ + id obj; + NSArray *davNamespaces; + NSDictionary *davInvocation; + NSString *objcMethod; + + obj = [super lookupName: lookupName inContext: localContext + acquire: acquire]; + if (!obj) + { + davNamespaces = [self davNamespaces]; + if ([davNamespaces count] > 0) + { + davInvocation = [lookupName asDavInvocation]; + if (davInvocation + && [davNamespaces + containsObject: [davInvocation objectForKey: @"ns"]]) + { + objcMethod = [[davInvocation objectForKey: @"method"] + davMethodToObjC]; + obj = [[SoSelectorInvocation alloc] + initWithSelectorNamed: + [NSString stringWithFormat: @"%@:", objcMethod] + addContextParameter: YES]; + [obj autorelease]; + } + } + } + + return obj; +} + /* WebDAV */ +- (NSArray *) davNamespaces +{ + return nil; +} + - (BOOL) davIsCollection { return [self isFolderish];