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
23 #include "SOGoMailFolder.h"
24 #include "SOGoMailObject.h"
27 @implementation SOGoMailFolder
31 - (NSString *)relativeImap4Name {
32 return [self nameInContainer];
37 - (BOOL)isMessageKey:(NSString *)_key inContext:(id)_ctx {
39 Every key starting with a digit is consider an IMAP4 message key. This is
40 not entirely correct since folders could also start with a number.
42 If we want to support folders beginning with numbers, we would need to
43 scan the folder list for the _key, which would make everything quite a bit
45 TODO: support this mode using a default.
47 if ([_key length] == 0)
50 if (isdigit([_key characterAtIndex:0]))
56 - (id)lookupImap4Folder:(NSString *)_key inContext:(id)_ctx {
57 // TODO: we might want to check for existence prior controller creation
58 return [[[SOGoMailFolder alloc] initWithName:_key
59 inContainer:self] autorelease];
61 - (id)lookupImap4Message:(NSString *)_key inContext:(id)_ctx {
62 // TODO: we might want to check for existence prior controller creation
63 return [[[SOGoMailObject alloc] initWithName:_key
64 inContainer:self] autorelease];
67 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
70 /* first check attributes directly bound to the application */
71 if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil)
74 obj = [self isMessageKey:_key inContext:_ctx]
75 ? [self lookupImap4Message:_key inContext:_ctx]
76 : [self lookupImap4Folder:_key inContext:_ctx];
80 /* return 404 to stop acquisition */
81 return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
84 @end /* SOGoMailFolder */