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 "MAPIStoreMailMessageTable.h"
|
||||||
#import "MAPIStoreMapping.h"
|
#import "MAPIStoreMapping.h"
|
||||||
#import "MAPIStoreTypes.h"
|
#import "MAPIStoreTypes.h"
|
||||||
|
#import "MAPIStoreUserContext.h"
|
||||||
#import "NSData+MAPIStore.h"
|
#import "NSData+MAPIStore.h"
|
||||||
#import "NSString+MAPIStore.h"
|
#import "NSString+MAPIStore.h"
|
||||||
#import "SOGoMAPIDBMessage.h"
|
#import "SOGoMAPIDBMessage.h"
|
||||||
|
@ -408,7 +409,18 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
|
||||||
|
|
||||||
- (BOOL) supportsSubFolders
|
- (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 */
|
/* synchronisation */
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
|
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
MAPIStoreAuthenticator *authenticator;
|
MAPIStoreAuthenticator *authenticator;
|
||||||
|
|
||||||
|
BOOL inboxHasNoInferiors;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) userContextWithUsername: (NSString *) username
|
+ (id) userContextWithUsername: (NSString *) username
|
||||||
|
@ -75,6 +77,8 @@
|
||||||
|
|
||||||
- (NSDictionary *) rootFolders;
|
- (NSDictionary *) rootFolders;
|
||||||
|
|
||||||
|
- (BOOL) inboxHasNoInferiors;
|
||||||
|
|
||||||
- (NSURL *) folderTableURL;
|
- (NSURL *) folderTableURL;
|
||||||
- (MAPIStoreMapping *) mapping;
|
- (MAPIStoreMapping *) mapping;
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,9 @@ static NSMapTable *contextsTable = nil;
|
||||||
{
|
{
|
||||||
SOGoMailAccounts *accountsFolder;
|
SOGoMailAccounts *accountsFolder;
|
||||||
id currentFolder;
|
id currentFolder;
|
||||||
|
NGImap4Connection *connection;
|
||||||
|
NSDictionary *hierarchy;
|
||||||
|
NSArray *flags;
|
||||||
|
|
||||||
if (!rootFolders)
|
if (!rootFolders)
|
||||||
{
|
{
|
||||||
|
@ -236,17 +239,32 @@ static NSMapTable *contextsTable = nil;
|
||||||
[containersBag addObject: accountsFolder];
|
[containersBag addObject: accountsFolder];
|
||||||
[woContext setClientObject: accountsFolder];
|
[woContext setClientObject: accountsFolder];
|
||||||
currentFolder = [accountsFolder lookupName: @"0"
|
currentFolder = [accountsFolder lookupName: @"0"
|
||||||
inContext: woContext
|
inContext: woContext
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
|
|
||||||
[rootFolders setObject: currentFolder
|
[rootFolders setObject: currentFolder
|
||||||
forKey: @"mail"];
|
forKey: @"mail"];
|
||||||
[[currentFolder imap4Connection]
|
connection = [currentFolder imap4Connection];
|
||||||
enableExtensions: [NSArray arrayWithObject: @"QRESYNC"]];
|
[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;
|
return rootFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) inboxHasNoInferiors
|
||||||
|
{
|
||||||
|
[self rootFolders];
|
||||||
|
|
||||||
|
return inboxHasNoInferiors;
|
||||||
|
}
|
||||||
|
|
||||||
- (MAPIStoreMapping *) mapping
|
- (MAPIStoreMapping *) mapping
|
||||||
{
|
{
|
||||||
return mapping;
|
return mapping;
|
||||||
|
|
Loading…
Reference in New Issue