2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 // $Id: SOGoCustomGroupFolder.m 115 2004-06-30 11:57:37Z helge $
23 #include "SOGoCustomGroupFolder.h"
26 @implementation SOGoCustomGroupFolder
28 static NSString *SOGoUIDSeparator = @",";
30 - (id)initWithUIDs:(NSArray *)_uids inContainer:(id)_container {
31 if ((self = [self initWithName:nil inContainer:_container])) {
32 self->uids = [_uids copy];
44 - (NSArray *)unescapeURLComponents:(NSArray *)_parts {
45 // #warning TODO: implement URL UID unescaping if necessary
46 // TODO: who calls this for what?
47 // Note: remember URL encoding!
55 if (self->uids != nil)
58 s = [self nameInContainer];
59 if (![s hasPrefix:@"_custom_"]) {
60 [self logWithFormat:@"WARNING: incorrect custom group folder name: '%@'",
65 s = [s substringFromIndex:8];
66 a = [s componentsSeparatedByString:SOGoUIDSeparator];
67 a = [self unescapeURLComponents:a];
68 self->uids = [a copy];
70 if ([self->uids count] < 2)
71 [self debugWithFormat:@"Note: less than two custom group members!"];
78 - (NSString *)davDisplayName {
83 if ((count = [a count]) == 0)
86 return [a objectAtIndex:0];
92 ms = [NSMutableString stringWithCapacity:64];
93 for (i = 0; i < count; i++) {
94 if (i != 0) [ms appendString:@"|"];
95 [ms appendString:[a objectAtIndex:i]];
96 if ([ms length] > 60) {
101 if (ms != nil) return ms;
104 // TODO: localize 'members' (UI component task?)
105 return [NSString stringWithFormat:@"Members: %d", count];
108 @end /* SOGoCustomGroupFolder */