diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index b107b94f0..6d8de37ad 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -699,7 +699,7 @@ static BOOL debugOn = NO; SOGoMailAccount *accountFolder; NSMutableString *s, *commands; SOGoUserFolder *userFolder; - NSMutableArray *folders; + NSMutableArray *folders, *processedFolders; SoSecurityManager *sm; SOGoCacheGCSObject *o; id currentFolder; @@ -719,6 +719,8 @@ static BOOL debugOn = NO; command_count = 0; commands = [NSMutableString string]; + processedFolders = [NSMutableArray array]; + [s appendString: @""]; [s appendString: @""]; @@ -727,7 +729,7 @@ static BOOL debugOn = NO; first_sync = YES; syncKey = @"1"; } - else if (![syncKey isEqualToString: [metadata objectForKey: @"FolderSyncKey"]]) + else if (![metadata objectForKey: @"FolderSyncKey"]) { // Synchronization key mismatch or invalid synchronization key //NSLog(@"FolderSync syncKey mismatch %@ <> %@", syncKey, metadata); @@ -862,7 +864,13 @@ static BOOL debugOn = NO; serverId = [NSString stringWithFormat: @"mail/%@", [[imapGUIDs objectForKey: nameInCache] substringFromIndex: 6]]; name = [folderMetadata objectForKey: @"displayName"]; - + + // avoid duplicate folders if folder is returned by different imap namespaces + if ([processedFolders indexOfObject: serverId] == NSNotFound) + [processedFolders addObject: serverId]; + else + continue; + if ([name hasPrefix: @"/"]) name = [name substringFromIndex: 1]; @@ -874,7 +882,10 @@ static BOOL debugOn = NO; if ([folderMetadata objectForKey: @"parent"]) { - parentId = [NSString stringWithFormat: @"mail/%@", [[imapGUIDs objectForKey: [NSString stringWithFormat: @"folder%@", [[folderMetadata objectForKey: @"parent"] substringFromIndex: 1]]] substringFromIndex: 6]]; + // make sure that parent of main-folders is always 0 + if (type == 12) + parentId = [NSString stringWithFormat: @"mail/%@", [[imapGUIDs objectForKey: [NSString stringWithFormat: @"folder%@", [[folderMetadata objectForKey: @"parent"] substringFromIndex: 1]]] substringFromIndex: 6]]; + name = [[name pathComponents] lastObject]; } diff --git a/NEWS b/NEWS index cb6c05995..6f5018167 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,9 @@ Bug fixes - properly support big characters in EAS and fix encoding QP EAS error for Outlook (#3082) - properly encode id of DOM elements in Address Book module (#3239, #3245) - fixed multi-domain support for sogo-tool backup/restore (#2600) + - fixed data ordering in events list of Calendar module (#3261) + - fixed data ordering in tasks list of Calendar module (#3267) + - Android EAS Lollipop fixes (#3268 and #3269) 2.3.0 (2015-06-01) -------------------