/* listing the available folders */
- (NSArray *)toManyRelationshipKeys {
- NSArray *a, *b;
+ NSMutableArray *m;
+ NSArray *b;
- a = [self additionalRootFolderNames];
- // TODO: we also need to add the INBOX here (the 'real' INBOX is the root)
+ m = [NSMutableArray arrayWithCapacity:16];
- b = [[self imap4Connection] subfoldersForURL:[self imap4URL]];
- return [b count] > 0 ? [b arrayByAddingObjectsFromArray:a] : a;
+ [m addObject:@"INBOX"]; /* special for shared, see -lookupInboxFolder:.. */
+
+ if ((b = [[self imap4Connection] subfoldersForURL:[self imap4URL]]) != nil)
+ [m addObjectsFromArray:b];
+
+ [m addObjectsFromArray:[self additionalRootFolderNames]];
+ return m;
}
/* IMAP4 locator */
return s;
}
+/* lookup */
+
+- (id)lookupInboxFolder:(NSString *)_key inContext:(id)_ctx {
+ /*
+ Note: We have a choice: Cyrus does both, it gives the user an own
+ INBOX folder, but it also provides access to the mailbox INBOX
+ folder.
+ However the mailbox INBOX folder is NOT returned as an "INBOX"
+ subcollection as usual, but is the primary mailbox name.
+ Eg:
+ 2 list "*" "*"
+ * LIST (\Noinferiors) "/" "INBOX"
+ * LIST (\HasChildren) "/" "Boite partag&AOk-e/alienor.a"
+
+ The first INBOX is auto-assigned for the user by Cyrus, the second entry
+ is actually the INBOX of the mailbox itself (alienor.a).
+ */
+ [self logWithFormat:@"TODO: return shared Inbox folder ..."];
+ return nil;
+}
+
+- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+ if ([_key isEqualToString:@"INBOX"])
+ return [self lookupInboxFolder:_key inContext:_ctx];
+
+ return [super lookupName:_key inContext:_ctx acquire:_flag];
+}
+
@end /* SOGoSharedMailAccount */