From 08c4ffe18effad22c219b0c13d50f4531bd99a6b Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 14 Feb 2005 16:51:09 +0000 Subject: [PATCH] fixed problem with Cyrus altnamespace git-svn-id: http://svn.opengroupware.org/SOGo/trunk@560 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 9 +++++++++ SOGo/SoObjects/Mailer/SOGoMailAccount.m | 11 +++++++---- SOGo/SoObjects/Mailer/SOGoMailManager.m | 16 ++++++++++------ SOGo/SoObjects/Mailer/Version | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 4565a458..1e74cf3b 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,12 @@ +2005-02-14 Helge Hess + + * v0.9.74 + + * SOGoMailAccount.m: fetch all root folders from IMAP4, do not assume + "INBOX" + + * SOGoMailManager.m: properly support rootfolders in IMAP4 + 2005-02-13 Helge Hess * SOGoMailAccount.m: changed short title creation to use login@host diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccount.m b/SOGo/SoObjects/Mailer/SOGoMailAccount.m index 1d429846..a1eb1083 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccount.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccount.m @@ -38,14 +38,12 @@ static NSString *sieveFolderName = @"Filters"; if ([ud boolForKey:@"SOGoEnableSieveFolder"]) { rootFolderNames = [[NSArray alloc] initWithObjects: - inboxFolderName, draftsFolderName, sieveFolderName, nil]; } else { rootFolderNames = [[NSArray alloc] initWithObjects: - inboxFolderName, draftsFolderName, nil]; } @@ -54,8 +52,13 @@ static NSString *sieveFolderName = @"Filters"; /* listing the available folders */ - (NSArray *)toManyRelationshipKeys { - // TODO: hardcoded, if we want to support shared fldrs, this needs to change - return rootFolderNames; + NSArray *a, *b; + + a = rootFolderNames; + + b = [[self mailManager] subfoldersForURL:[self imap4URL] + password:[self imap4Password]]; + return [b count] > 0 ? [b arrayByAddingObjectsFromArray:a] : a; } /* hierarchy */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.m b/SOGo/SoObjects/Mailer/SOGoMailManager.m index fd6ba062..cf7ddb58 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.m +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.m @@ -40,7 +40,8 @@ static BOOL debugOn = NO; static BOOL debugCache = NO; static BOOL debugKeys = NO; static BOOL poolingOff = NO; -static BOOL alwaysSelect = NO; +static BOOL alwaysSelect = NO; +static BOOL onlyFetchInbox = NO; static NSTimeInterval PoolScanInterval = 5 * 60; static NSString *imap4Separator = nil; @@ -256,7 +257,7 @@ static NSString *imap4Separator = nil; /* one entry is the folder itself, so we need at least two */ return [NSArray array]; - prefixlen = [_fn length] + 1; + prefixlen = [_fn isEqualToString:@"/"] ? 1 : [_fn length] + 1; ma = [NSMutableArray arrayWithCapacity:count]; for (i = 0; i < count; i++) { NSString *p; @@ -337,12 +338,14 @@ static NSString *imap4Separator = nil; return nil; } - if (debugKeys) - [self logWithFormat:@"all keys %@: %@", folderName, [result allKeys]]; + if (debugKeys) { + [self logWithFormat:@"all keys %@: %@", folderName, + [[result allKeys] componentsJoinedByString:@", "]]; + } names = [self _getDirectChildren:[result allKeys] folderName:folderName]; if (debugKeys) { - [self debugWithFormat:@"subfolders of %@: %@", folderName, + [self logWithFormat:@"subfolders of '%@': %@", folderName, [names componentsJoinedByString:@","]]; } return names; @@ -374,7 +377,8 @@ static NSString *imap4Separator = nil; /* fetch _all_ folders */ - result = [[entry client] list:@"INBOX" pattern:@"*"]; + result = [[entry client] list:(onlyFetchInbox ? @"INBOX" : @"*") + pattern:@"*"]; if (![[result valueForKey:@"result"] boolValue]) { [self errorWithFormat:@"listing of folder failed!"]; return nil; diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 77d2e6e0..b127af6b 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=73 +SUBMINOR_VERSION:=74 # v0.9.69 requires libNGMime v4.5.210 # v0.9.55 requires libNGExtensions v4.5.136 -- 2.39.5