]> err.no Git - scalable-opengroupware.org/blobdiff - SOGo/SoObjects/Mailer/SOGoSharedMailAccount.m
use new clientObject share API in UI
[scalable-opengroupware.org] / SOGo / SoObjects / Mailer / SOGoSharedMailAccount.m
index 7c2648551a2d9d5370b463db50549c500208208a..eb509f7f20d0ccff3cce636829eb417d65c6b013 100644 (file)
@@ -63,13 +63,18 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
 /* 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 */
@@ -85,4 +90,32 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
   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 */