mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 18:35:25 +00:00
oc-mail: Support restricitions on name for MAPIStoreMailFolderTable
This allows us to search for a subfolder in a mail folder successfully. This is happening, for instance, on folder creation.
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#import "MAPIStoreFAIMessage.h"
|
||||
#import "MAPIStoreMailContext.h"
|
||||
#import "MAPIStoreMailMessage.h"
|
||||
#import "MAPIStoreMailFolderTable.h"
|
||||
#import "MAPIStoreMailMessageTable.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
@@ -154,6 +155,11 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
|
||||
return [MAPIStoreMailMessageTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (MAPIStoreFolderTable *) folderTable
|
||||
{
|
||||
return [MAPIStoreMailFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID
|
||||
andKey: (NSString **) newKeyP
|
||||
@@ -359,12 +365,17 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSArray *filteredSubfolderKeys;
|
||||
NSMutableArray *subfolderKeys;
|
||||
NSMutableArray *subfolderKeysQualifying;
|
||||
NSString *subfolderKey;
|
||||
NSUInteger count, max;
|
||||
|
||||
if ([self ensureFolderExists])
|
||||
{
|
||||
/* Only folder name can be used as qualifier key */
|
||||
if (qualifier)
|
||||
[self errorWithFormat: @"qualifier is not used for folders"];
|
||||
[self warnWithFormat: @"qualifier is only used for folders with name"];
|
||||
if (sortOrderings)
|
||||
[self errorWithFormat: @"sort orderings are not used for folders"];
|
||||
|
||||
@@ -372,6 +383,31 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
|
||||
[subfolderKeys autorelease];
|
||||
|
||||
[self _cleanupSubfolderKeys: subfolderKeys];
|
||||
|
||||
if (qualifier)
|
||||
{
|
||||
subfolderKeysQualifying = [NSMutableArray array];
|
||||
max = [subfolderKeys count];
|
||||
for (count = 0; count < max; count++) {
|
||||
subfolderKey = [subfolderKeys objectAtIndex: count];
|
||||
/* Remove "folder" prefix */
|
||||
subfolderKey = [subfolderKey substringFromIndex: 6];
|
||||
subfolderKey = [[subfolderKey fromCSSIdentifier] stringByDecodingImap4FolderName];
|
||||
[subfolderKeysQualifying addObject: [NSDictionary dictionaryWithObject: subfolderKey
|
||||
forKey: @"name"]];
|
||||
}
|
||||
filteredSubfolderKeys = [subfolderKeysQualifying filteredArrayUsingQualifier: qualifier];
|
||||
|
||||
max = [filteredSubfolderKeys count];
|
||||
subfolderKeys = [NSMutableArray arrayWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
subfolderKey = [[filteredSubfolderKeys objectAtIndex: count] valueForKey: @"name"];
|
||||
subfolderKey = [NSString stringWithFormat: @"folder%@", [[subfolderKey stringByEncodingImap4FolderName] asCSSIdentifier]];
|
||||
[subfolderKeys addObject: subfolderKey];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
subfolderKeys = nil;
|
||||
|
||||
Reference in New Issue
Block a user