From e7bfeeddc50d315ffc35bd1fdc2b6a382d5571e0 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 7 Nov 2007 22:27:44 +0000 Subject: [PATCH] Monotone-Parent: d38b82f4d070ced8ba970b79c220008c590b1e3d Monotone-Revision: 3ac4c919862b563bc50cb104a7497a366ffc80a9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-07T22:27:44 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoFolder.h | 46 +++++++++++ SoObjects/SOGo/SOGoFolder.m | 149 ++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 SoObjects/SOGo/SOGoFolder.h create mode 100644 SoObjects/SOGo/SOGoFolder.m diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h new file mode 100644 index 000000000..ee5de48e4 --- /dev/null +++ b/SoObjects/SOGo/SOGoFolder.h @@ -0,0 +1,46 @@ +/* SOGoFolder.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef SOGOFOLDER_H +#define SOGOFOLDER_H + +#import "SOGoObject.h" + +@interface SOGoFolder : SOGoObject +{ + NSMutableString *displayName; +} + +- (void) setDisplayName: (NSString *) newDisplayName; +- (NSString *) displayName; + +- (NSString *) folderType; + +/* dav */ +- (NSArray *) davNamespaces; + +/* outlook */ +- (NSString *) outlookFolderClass; + +@end + +#endif /* SOGOFOLDER_H */ diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m new file mode 100644 index 000000000..af83275ea --- /dev/null +++ b/SoObjects/SOGo/SOGoFolder.m @@ -0,0 +1,149 @@ +/* SOGoFolder.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import + +#import + +#import "NSString+Utilities.h" + +#import "SOGoFolder.h" + +@implementation SOGoFolder + +- (id) init +{ + if ((self = [super init])) + displayName = nil; + + return self; +} + +- (void) dealloc +{ + [displayName release]; + [super dealloc]; +} + +- (void) setDisplayName: (NSString *) newDisplayName +{ + ASSIGN (displayName, newDisplayName); +} + +- (NSString *) displayName +{ + return ((displayName) ? displayName : nameInContainer); +} + +- (NSString *) folderType +{ + [self subclassResponsibility: _cmd]; + + return nil; +} + +- (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; +} + +- (BOOL) isFolderish +{ + return YES; +} + +- (NSString *) httpURLForAdvisoryToUser: (NSString *) uid +{ + return [[self soURL] absoluteString]; +} + +- (NSString *) resourceURLForAdvisoryToUser: (NSString *) uid +{ + return [[self davURL] absoluteString]; +} + +/* WebDAV */ + +- (NSArray *) davNamespaces +{ + return nil; +} + +- (BOOL) davIsCollection +{ + return [self isFolderish]; +} + +- (NSString *) davContentType +{ + return @"httpd/unix-directory"; +} + +/* folder type */ + +- (NSString *) outlookFolderClass +{ + [self subclassResponsibility: _cmd]; + + return nil; +} + +/* acls */ + +- (NSArray *) aclsForUser: (NSString *) uid +{ + return nil; +} + +@end