(feat) now supports RFC6154 and NoInferiors IMAP flag
parent
f5b28b0274
commit
693f80dc9a
1
NEWS
1
NEWS
|
@ -6,6 +6,7 @@ Enhancements
|
|||
- [web] updated Material Icons font to version 2.1.3
|
||||
- [web] don't offer forward/vacation options in filters if not enabled
|
||||
- [web] mail filters are now sortable
|
||||
- [web] now supports RFC6154 and NoInferiors IMAP flag
|
||||
|
||||
Bug fixes
|
||||
- [web] handle birthday dates before 1970
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<var:string label:value="Mark Folder Read"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item>
|
||||
<md-menu-item ng-hide="folder.$isNoInferiors">
|
||||
<md-button type="button" ng-click="app.newFolder(folder)">
|
||||
<var:string label:value="New Subfolder..."/>
|
||||
</md-button>
|
||||
|
|
|
@ -165,6 +165,7 @@
|
|||
if (this.type) {
|
||||
this.$isEditable = this.isEditable();
|
||||
}
|
||||
this.$isNoInferiors = this.isNoInferiors();
|
||||
if (angular.isUndefined(this.$shadowData)) {
|
||||
// Make a copy of the data for an eventual reset
|
||||
this.$shadowData = this.$omit();
|
||||
|
@ -375,6 +376,16 @@
|
|||
return this.type == 'folder';
|
||||
};
|
||||
|
||||
/**
|
||||
* @function isNoInferiors
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Checks if the mailbox can contain submailboxes
|
||||
* @returns true if the mailbox can not contain submailboxes
|
||||
*/
|
||||
Mailbox.prototype.isNoInferiors = function() {
|
||||
return this.flags.indexOf('noinferiors') >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $rename
|
||||
* @memberof AddressBook.prototype
|
||||
|
@ -721,7 +732,7 @@
|
|||
Mailbox.$timeout(function() {
|
||||
var uids, headers;
|
||||
|
||||
if (_this.$topIndex > data.uids.length - 1)
|
||||
if (!data.uids || _this.$topIndex > data.uids.length - 1)
|
||||
_this.$topIndex = 0;
|
||||
|
||||
_this.init(data);
|
||||
|
|
Loading…
Reference in New Issue