Check whether the "INBOX" folder has the "noinferiors" flag set before declaring that it accepts subfolder creation
parent
e837323c2e
commit
37ccb0875c
|
@ -53,6 +53,7 @@
|
|||
#import "MAPIStoreMailMessageTable.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import "SOGoMAPIDBMessage.h"
|
||||
|
@ -408,7 +409,18 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
|
|||
|
||||
- (BOOL) supportsSubFolders
|
||||
{
|
||||
return YES;
|
||||
BOOL supportsSubFolders;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
if ([[self nameInContainer] isEqualToString: @"folderINBOX"])
|
||||
{
|
||||
userContext = [self userContext];
|
||||
supportsSubFolders = ![userContext inboxHasNoInferiors];
|
||||
}
|
||||
else
|
||||
supportsSubFolders = YES;
|
||||
|
||||
return supportsSubFolders;
|
||||
}
|
||||
|
||||
/* synchronisation */
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
|
||||
WOContext *woContext;
|
||||
MAPIStoreAuthenticator *authenticator;
|
||||
|
||||
BOOL inboxHasNoInferiors;
|
||||
}
|
||||
|
||||
+ (id) userContextWithUsername: (NSString *) username
|
||||
|
@ -75,6 +77,8 @@
|
|||
|
||||
- (NSDictionary *) rootFolders;
|
||||
|
||||
- (BOOL) inboxHasNoInferiors;
|
||||
|
||||
- (NSURL *) folderTableURL;
|
||||
- (MAPIStoreMapping *) mapping;
|
||||
|
||||
|
|
|
@ -206,6 +206,9 @@ static NSMapTable *contextsTable = nil;
|
|||
{
|
||||
SOGoMailAccounts *accountsFolder;
|
||||
id currentFolder;
|
||||
NGImap4Connection *connection;
|
||||
NSDictionary *hierarchy;
|
||||
NSArray *flags;
|
||||
|
||||
if (!rootFolders)
|
||||
{
|
||||
|
@ -236,17 +239,32 @@ static NSMapTable *contextsTable = nil;
|
|||
[containersBag addObject: accountsFolder];
|
||||
[woContext setClientObject: accountsFolder];
|
||||
currentFolder = [accountsFolder lookupName: @"0"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
|
||||
[rootFolders setObject: currentFolder
|
||||
forKey: @"mail"];
|
||||
[[currentFolder imap4Connection]
|
||||
enableExtensions: [NSArray arrayWithObject: @"QRESYNC"]];
|
||||
connection = [currentFolder imap4Connection];
|
||||
[connection enableExtensions: [NSArray arrayWithObject: @"QRESYNC"]];
|
||||
|
||||
/* ensure the folder cache is filled */
|
||||
[currentFolder toManyRelationshipKeysWithNamespaces: YES];
|
||||
hierarchy = [connection
|
||||
cachedHierarchyResultsForURL: [currentFolder imap4URL]];
|
||||
flags = [[hierarchy objectForKey: @"list"] objectForKey: @"/INBOX"];
|
||||
inboxHasNoInferiors = [flags containsObject: @"noinferiors"];
|
||||
}
|
||||
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
- (BOOL) inboxHasNoInferiors
|
||||
{
|
||||
[self rootFolders];
|
||||
|
||||
return inboxHasNoInferiors;
|
||||
}
|
||||
|
||||
- (MAPIStoreMapping *) mapping
|
||||
{
|
||||
return mapping;
|
||||
|
|
Loading…
Reference in New Issue