mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-21 22:53:18 +00:00
(feat) now supports RFC6154 and NoInferiors IMAP flag
This commit is contained in:
@@ -410,23 +410,42 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
//
|
||||
//
|
||||
- (NSString *) _folderType: (NSString *) folderName
|
||||
flags: (NSMutableArray *) flags
|
||||
{
|
||||
NSString *folderType;
|
||||
NSString *folderType, *key;
|
||||
NSDictionary *metadata;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
|
||||
metadata = [[[self imap4Connection] allFoldersMetadataForURL: [self imap4URL]
|
||||
onlySubscribedFolders: [ud mailShowSubscribedFoldersOnly]]
|
||||
objectForKey: @"list"];
|
||||
|
||||
key = [NSString stringWithFormat: @"/%@", folderName];
|
||||
[flags addObjectsFromArray: [metadata objectForKey: key]];
|
||||
|
||||
// RFC6154 (https://tools.ietf.org/html/rfc6154) describes special uses for IMAP mailboxes.
|
||||
// We do honor them, as long as your SOGo{Drafts,Trash,Sent,Junk}FolderName are properly configured
|
||||
// See http://wiki.dovecot.org/MailboxSettings for a Dovecot example.
|
||||
if ([folderName isEqualToString: inboxFolderName])
|
||||
folderType = @"inbox";
|
||||
else if ([folderName isEqualToString: [self draftsFolderNameInContext: context]])
|
||||
else if ([flags containsObject: [self draftsFolderNameInContext: context]] ||
|
||||
[folderName isEqualToString: [self draftsFolderNameInContext: context]])
|
||||
folderType = @"draft";
|
||||
else if ([folderName isEqualToString: [self sentFolderNameInContext: context]])
|
||||
else if ([flags containsObject: [self sentFolderNameInContext: context]] ||
|
||||
[folderName isEqualToString: [self sentFolderNameInContext: context]])
|
||||
folderType = @"sent";
|
||||
else if ([folderName isEqualToString: [self trashFolderNameInContext: context]])
|
||||
else if ([flags containsObject: [self trashFolderNameInContext: context]] ||
|
||||
[folderName isEqualToString: [self trashFolderNameInContext: context]])
|
||||
folderType = @"trash";
|
||||
else if ([flags containsObject: [self junkFolderNameInContext: context]] ||
|
||||
[folderName isEqualToString: [self junkFolderNameInContext: context]])
|
||||
folderType = @"junk";
|
||||
else if ([folderName isEqualToString: otherUsersFolderName])
|
||||
folderType = @"otherUsers";
|
||||
else if ([folderName isEqualToString: sharedFoldersName])
|
||||
folderType = @"shared";
|
||||
else if ([folderName isEqualToString: [self junkFolderNameInContext: context]])
|
||||
folderType = @"junk";
|
||||
else
|
||||
folderType = @"folder";
|
||||
|
||||
@@ -437,7 +456,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
foldersList: (NSMutableArray *) theFolders
|
||||
{
|
||||
NSArray *pathComponents;
|
||||
NSMutableArray *folders;
|
||||
NSMutableArray *folders, *flags;
|
||||
NSMutableDictionary *currentFolder, *parentFolder, *folder;
|
||||
NSString *currentFolderName, *currentPath, *fullName, *folderType;
|
||||
SOGoUserManager *userManager;
|
||||
@@ -519,8 +538,11 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
currentFolderName = [self labelForKey: @"SharedFoldersName"];
|
||||
}
|
||||
|
||||
flags = [NSMutableArray array];;
|
||||
|
||||
if (last)
|
||||
folderType = [self _folderType: currentPath];
|
||||
folderType = [self _folderType: currentPath
|
||||
flags: flags];
|
||||
else
|
||||
folderType = @"additional";
|
||||
|
||||
@@ -529,6 +551,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
folderType, @"type",
|
||||
currentFolderName, @"name",
|
||||
[NSMutableArray array], @"children",
|
||||
flags, @"flags",
|
||||
nil];
|
||||
// Either add this new folder to its parent or the list of root folders
|
||||
[folders addObject: folder];
|
||||
|
||||
Reference in New Issue
Block a user