(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] updated Material Icons font to version 2.1.3
|
||||||
- [web] don't offer forward/vacation options in filters if not enabled
|
- [web] don't offer forward/vacation options in filters if not enabled
|
||||||
- [web] mail filters are now sortable
|
- [web] mail filters are now sortable
|
||||||
|
- [web] now supports RFC6154 and NoInferiors IMAP flag
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [web] handle birthday dates before 1970
|
- [web] handle birthday dates before 1970
|
||||||
|
|
|
@ -410,23 +410,42 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
- (NSString *) _folderType: (NSString *) folderName
|
- (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])
|
if ([folderName isEqualToString: inboxFolderName])
|
||||||
folderType = @"inbox";
|
folderType = @"inbox";
|
||||||
else if ([folderName isEqualToString: [self draftsFolderNameInContext: context]])
|
else if ([flags containsObject: [self draftsFolderNameInContext: context]] ||
|
||||||
|
[folderName isEqualToString: [self draftsFolderNameInContext: context]])
|
||||||
folderType = @"draft";
|
folderType = @"draft";
|
||||||
else if ([folderName isEqualToString: [self sentFolderNameInContext: context]])
|
else if ([flags containsObject: [self sentFolderNameInContext: context]] ||
|
||||||
|
[folderName isEqualToString: [self sentFolderNameInContext: context]])
|
||||||
folderType = @"sent";
|
folderType = @"sent";
|
||||||
else if ([folderName isEqualToString: [self trashFolderNameInContext: context]])
|
else if ([flags containsObject: [self trashFolderNameInContext: context]] ||
|
||||||
|
[folderName isEqualToString: [self trashFolderNameInContext: context]])
|
||||||
folderType = @"trash";
|
folderType = @"trash";
|
||||||
|
else if ([flags containsObject: [self junkFolderNameInContext: context]] ||
|
||||||
|
[folderName isEqualToString: [self junkFolderNameInContext: context]])
|
||||||
|
folderType = @"junk";
|
||||||
else if ([folderName isEqualToString: otherUsersFolderName])
|
else if ([folderName isEqualToString: otherUsersFolderName])
|
||||||
folderType = @"otherUsers";
|
folderType = @"otherUsers";
|
||||||
else if ([folderName isEqualToString: sharedFoldersName])
|
else if ([folderName isEqualToString: sharedFoldersName])
|
||||||
folderType = @"shared";
|
folderType = @"shared";
|
||||||
else if ([folderName isEqualToString: [self junkFolderNameInContext: context]])
|
|
||||||
folderType = @"junk";
|
|
||||||
else
|
else
|
||||||
folderType = @"folder";
|
folderType = @"folder";
|
||||||
|
|
||||||
|
@ -437,7 +456,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
foldersList: (NSMutableArray *) theFolders
|
foldersList: (NSMutableArray *) theFolders
|
||||||
{
|
{
|
||||||
NSArray *pathComponents;
|
NSArray *pathComponents;
|
||||||
NSMutableArray *folders;
|
NSMutableArray *folders, *flags;
|
||||||
NSMutableDictionary *currentFolder, *parentFolder, *folder;
|
NSMutableDictionary *currentFolder, *parentFolder, *folder;
|
||||||
NSString *currentFolderName, *currentPath, *fullName, *folderType;
|
NSString *currentFolderName, *currentPath, *fullName, *folderType;
|
||||||
SOGoUserManager *userManager;
|
SOGoUserManager *userManager;
|
||||||
|
@ -519,8 +538,11 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
currentFolderName = [self labelForKey: @"SharedFoldersName"];
|
currentFolderName = [self labelForKey: @"SharedFoldersName"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flags = [NSMutableArray array];;
|
||||||
|
|
||||||
if (last)
|
if (last)
|
||||||
folderType = [self _folderType: currentPath];
|
folderType = [self _folderType: currentPath
|
||||||
|
flags: flags];
|
||||||
else
|
else
|
||||||
folderType = @"additional";
|
folderType = @"additional";
|
||||||
|
|
||||||
|
@ -529,6 +551,7 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
folderType, @"type",
|
folderType, @"type",
|
||||||
currentFolderName, @"name",
|
currentFolderName, @"name",
|
||||||
[NSMutableArray array], @"children",
|
[NSMutableArray array], @"children",
|
||||||
|
flags, @"flags",
|
||||||
nil];
|
nil];
|
||||||
// Either add this new folder to its parent or the list of root folders
|
// Either add this new folder to its parent or the list of root folders
|
||||||
[folders addObject: folder];
|
[folders addObject: folder];
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
<var:string label:value="Mark Folder Read"/>
|
<var:string label:value="Mark Folder Read"/>
|
||||||
</md-button>
|
</md-button>
|
||||||
</md-menu-item>
|
</md-menu-item>
|
||||||
<md-menu-item>
|
<md-menu-item ng-hide="folder.$isNoInferiors">
|
||||||
<md-button type="button" ng-click="app.newFolder(folder)">
|
<md-button type="button" ng-click="app.newFolder(folder)">
|
||||||
<var:string label:value="New Subfolder..."/>
|
<var:string label:value="New Subfolder..."/>
|
||||||
</md-button>
|
</md-button>
|
||||||
|
|
|
@ -165,6 +165,7 @@
|
||||||
if (this.type) {
|
if (this.type) {
|
||||||
this.$isEditable = this.isEditable();
|
this.$isEditable = this.isEditable();
|
||||||
}
|
}
|
||||||
|
this.$isNoInferiors = this.isNoInferiors();
|
||||||
if (angular.isUndefined(this.$shadowData)) {
|
if (angular.isUndefined(this.$shadowData)) {
|
||||||
// Make a copy of the data for an eventual reset
|
// Make a copy of the data for an eventual reset
|
||||||
this.$shadowData = this.$omit();
|
this.$shadowData = this.$omit();
|
||||||
|
@ -375,6 +376,16 @@
|
||||||
return this.type == 'folder';
|
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
|
* @function $rename
|
||||||
* @memberof AddressBook.prototype
|
* @memberof AddressBook.prototype
|
||||||
|
@ -721,7 +732,7 @@
|
||||||
Mailbox.$timeout(function() {
|
Mailbox.$timeout(function() {
|
||||||
var uids, headers;
|
var uids, headers;
|
||||||
|
|
||||||
if (_this.$topIndex > data.uids.length - 1)
|
if (!data.uids || _this.$topIndex > data.uids.length - 1)
|
||||||
_this.$topIndex = 0;
|
_this.$topIndex = 0;
|
||||||
|
|
||||||
_this.init(data);
|
_this.init(data);
|
||||||
|
|
Loading…
Reference in New Issue