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
22 #import <Foundation/NSArray.h>
23 #import <Foundation/NSString.h>
25 #import <NGExtensions/NSObject+Logs.h>
27 #import "SOGoCustomGroupFolder.h"
29 @implementation SOGoCustomGroupFolder
31 static NSString *SOGoUIDSeparator = @",";
33 - (id)initWithUIDs:(NSArray *)_uids inContainer:(id)_container {
34 if ((self = [self initWithName:nil inContainer:_container])) {
35 self->uids = [_uids copy];
47 - (NSArray *)unescapeURLComponents:(NSArray *)_parts {
48 // #warning TODO: implement URL UID unescaping if necessary
49 // TODO: who calls this for what?
50 // Note: remember URL encoding!
58 if (self->uids != nil)
61 s = [self nameInContainer];
62 if (![s hasPrefix:@"_custom_"]) {
63 [self logWithFormat:@"WARNING: incorrect custom group folder name: '%@'",
68 s = [s substringFromIndex:8];
69 a = [s componentsSeparatedByString:SOGoUIDSeparator];
70 a = [self unescapeURLComponents:a];
71 self->uids = [a copy];
73 if ([self->uids count] < 2)
74 [self debugWithFormat:@"Note: less than two custom group members!"];
81 - (NSString *)davDisplayName {
86 if ((count = [a count]) == 0)
89 return [a objectAtIndex:0];
95 ms = [NSMutableString stringWithCapacity:64];
96 for (i = 0; i < count; i++) {
97 if (i != 0) [ms appendString:@"|"];
98 [ms appendString:[a objectAtIndex:i]];
99 if ([ms length] > 60) {
104 if (ms != nil) return ms;
107 // TODO: localize 'members' (UI component task?)
108 return [NSString stringWithFormat:@"Members: %d", count];
111 @end /* SOGoCustomGroupFolder */