Skip to content

Commit

Permalink
Fix support for SOGoSieveFolderEncoding defaults
Browse files Browse the repository at this point in the history
Cont'd. Fixes #3904
  • Loading branch information
cgx committed Dec 2, 2016
1 parent 6ce64a9 commit ba5bd65
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 19 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -4,6 +4,7 @@
Bug fixes
- [web] fixed confusion between owner and active user in ACLs management of Administration module
- [web] fixed JavaScript exception after renaming an address book
- [web] fixed Sieve folder encoding support (#3904)

3.2.4 (2016-12-01)
------------------
Expand Down
1 change: 1 addition & 0 deletions SoObjects/Mailer/SOGoMailAccount.h
Expand Up @@ -67,6 +67,7 @@ typedef enum {
NSString *otherUsersFolderName;
NSString *sharedFoldersName;
NSMutableDictionary *subscribedFolders;
BOOL sieveFolderUTF8Encoding;
}

- (SOGoIMAPAclStyle) imapAclStyle;
Expand Down
12 changes: 11 additions & 1 deletion SoObjects/Mailer/SOGoMailAccount.m
Expand Up @@ -37,6 +37,7 @@
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoAuthenticator.h>
#import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoSieveManager.h>
Expand All @@ -62,6 +63,7 @@ - (id) init
{
if ((self = [super init]))
{
NSString *sieveFolderEncoding = [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding];
inboxFolder = nil;
draftsFolder = nil;
sentFolder = nil;
Expand All @@ -72,6 +74,7 @@ - (id) init
otherUsersFolderName = nil;
sharedFoldersName = nil;
subscribedFolders = nil;
sieveFolderUTF8Encoding = [sieveFolderEncoding isEqualToString: @"UTF-8"];
}

return self;
Expand Down Expand Up @@ -461,7 +464,7 @@ - (NSMutableDictionary *) _insertFolder: (NSString *) folderPath
NSArray *pathComponents;
NSMutableArray *folders, *flags;
NSMutableDictionary *currentFolder, *parentFolder, *folder;
NSString *currentFolderName, *currentPath, *fullName, *folderType;
NSString *currentFolderName, *currentPath, *sievePath, *fullName, *folderType;
SOGoUserManager *userManager;

BOOL last, isOtherUsersFolder, parentIsOtherUsersFolder, isSubscribed;
Expand Down Expand Up @@ -550,6 +553,13 @@ - (NSMutableDictionary *) _insertFolder: (NSString *) folderPath
flags, @"flags",
[NSNumber numberWithBool: isSubscribed], @"subscribed",
nil];

if (sieveFolderUTF8Encoding)
sievePath = [folderPath stringByDecodingImap4FolderName];
else
sievePath = folderPath;
[folder setObject: [sievePath substringFromIndex: 1] forKey: @"sievePath"];

// Either add this new folder to its parent or the list of root folders
[folders addObject: folder];
}
Expand Down
8 changes: 0 additions & 8 deletions UI/PreferencesUI/UIxPreferences.m
Expand Up @@ -1622,14 +1622,6 @@ - (BOOL) shouldDisplayPasswordChange
userCanChangePassword];
}

//
// Used wox by template
//
- (NSString *) sieveFolderEncoding
{
return [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding];
}

// - (NSString *) localeCode
// {
// // WARNING : NSLocaleCode is not defined in <Foundation/NSUserDefaults.h>
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/PreferencesUI/UIxFilterEditor.wox
Expand Up @@ -146,7 +146,7 @@
<md-input-container class="md-block" flex="50" ng-if="action.method == 'fileinto'">
<label><var:string label:value="Mailbox"/></label>
<md-select ng-model="action.argument" required="required">
<md-option ng-value="item.path" ng-repeat="item in filterEditor.mailboxes">
<md-option ng-value="item.sievePath" ng-repeat="item in filterEditor.mailboxes">
<div ng-class="'sg-child-level-' + item.level">
{{ item.name }}
</div>
Expand Down
1 change: 0 additions & 1 deletion UI/Templates/PreferencesUI/UIxPreferences.wox
Expand Up @@ -21,7 +21,6 @@
var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>';
var forwardConstraints = <var:string value="forwardConstraints" const:escapeHTML="NO"/>;
var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
var sieveFolderEncoding = <var:string value="sieveFolderEncoding.doubleQuotedString"/>;
</script>

<script type="text/ng-template" id="preferences.html">
Expand Down
Expand Up @@ -12,8 +12,7 @@
var vm = this,
sieveCapabilities = $window.sieveCapabilities,
forwardEnabled = $window.forwardEnabled,
vacationEnabled = $window.vacationEnabled,
sieveFolderPathAttribute = ($window.sieveFolderEncoding == "UTF-8") ? "name" : "path";
vacationEnabled = $window.vacationEnabled;

vm.filter = filter;
vm.mailboxes = mailboxes;
Expand Down Expand Up @@ -51,12 +50,6 @@
//if (vacationEnabled)
// vm.methodLabels.vacation = l("Send a vacation message");

vm.mailboxes = _.map(mailboxes, function(mailbox) {
return { level: mailbox.level,
name: mailbox.name,
path: mailbox[sieveFolderPathAttribute] };
});

if (sieveCapabilities.indexOf("reject") > -1)
vm.methodLabels.reject = l("Send a reject message");

Expand Down

0 comments on commit ba5bd65

Please sign in to comment.