(fix) properly handle mail subfolders for EAS
parent
f8d71966b9
commit
96588aef6a
|
@ -697,6 +697,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) _flattenFolders: (NSArray *) theFolders
|
||||||
|
into: (NSMutableArray *) theTarget
|
||||||
|
parent: (NSString *) theParent
|
||||||
|
{
|
||||||
|
NSArray *o;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
[theTarget addObjectsFromArray: theFolders];
|
||||||
|
|
||||||
|
for (i = 0; i < [theFolders count]; i++)
|
||||||
|
{
|
||||||
|
if (theParent)
|
||||||
|
[[theFolders objectAtIndex: i] setObject: theParent forKey: @"parent"];
|
||||||
|
|
||||||
|
o = [[theFolders objectAtIndex: i] objectForKey: @"children"];
|
||||||
|
|
||||||
|
if (o)
|
||||||
|
[self _flattenFolders: o into: theTarget parent: [[theFolders objectAtIndex: i] objectForKey: @"path"]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// <?xml version="1.0"?>
|
// <?xml version="1.0"?>
|
||||||
// <!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
|
// <!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
|
||||||
|
@ -708,16 +729,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
inResponse: (WOResponse *) theResponse
|
inResponse: (WOResponse *) theResponse
|
||||||
{
|
{
|
||||||
NSString *key, *cKey, *nkey, *name, *serverId, *parentId, *nameInCache, *personalFolderName, *syncKey, *folderType, *operation;
|
NSString *key, *cKey, *nkey, *name, *serverId, *parentId, *nameInCache, *personalFolderName, *syncKey, *folderType, *operation;
|
||||||
|
NSMutableArray *folders, *processedFolders, *allFoldersMetadata;
|
||||||
NSMutableDictionary *cachedGUIDs, *metadata;
|
NSMutableDictionary *cachedGUIDs, *metadata;
|
||||||
NSMutableArray *folders, *processedFolders;
|
|
||||||
NSDictionary *folderMetadata, *imapGUIDs;
|
NSDictionary *folderMetadata, *imapGUIDs;
|
||||||
NSArray *allFoldersMetadata, *allKeys;
|
|
||||||
SOGoMailAccounts *accountsFolder;
|
SOGoMailAccounts *accountsFolder;
|
||||||
SOGoMailAccount *accountFolder;
|
SOGoMailAccount *accountFolder;
|
||||||
NSMutableString *s, *commands;
|
NSMutableString *s, *commands;
|
||||||
SOGoUserFolder *userFolder;
|
SOGoUserFolder *userFolder;
|
||||||
SoSecurityManager *sm;
|
SoSecurityManager *sm;
|
||||||
SOGoCacheGCSObject *o;
|
SOGoCacheGCSObject *o;
|
||||||
|
NSArray *allKeys;
|
||||||
id currentFolder;
|
id currentFolder;
|
||||||
NSData *d;
|
NSData *d;
|
||||||
|
|
||||||
|
@ -759,7 +780,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
|
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
|
||||||
accountFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
|
accountFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
|
||||||
|
|
||||||
allFoldersMetadata = [accountFolder allFoldersMetadata];
|
allFoldersMetadata = [NSMutableArray array];
|
||||||
|
[self _flattenFolders: [accountFolder allFoldersMetadata] into: allFoldersMetadata parent: nil];
|
||||||
|
|
||||||
// Get GUIDs of folder (IMAP)
|
// Get GUIDs of folder (IMAP)
|
||||||
// e.g. {folderINBOX = folder6b93c528176f1151c7260000aef6df92}
|
// e.g. {folderINBOX = folder6b93c528176f1151c7260000aef6df92}
|
||||||
|
@ -908,7 +930,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
{
|
{
|
||||||
// make sure that parent of main-folders is always 0
|
// make sure that parent of main-folders is always 0
|
||||||
if (type == 12)
|
if (type == 12)
|
||||||
parentId = [NSString stringWithFormat: @"mail/%@", [[imapGUIDs objectForKey: [NSString stringWithFormat: @"folder%@", [[folderMetadata objectForKey: @"parent"] substringFromIndex: 1]]] substringFromIndex: 6]];
|
parentId = [NSString stringWithFormat: @"mail/%@", [[imapGUIDs objectForKey: [NSString stringWithFormat: @"folder%@", [folderMetadata objectForKey: @"parent"]]] substringFromIndex: 6]];
|
||||||
|
|
||||||
name = [[name pathComponents] lastObject];
|
name = [[name pathComponents] lastObject];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue