From ba5bd65ea37b011907a582537345bd942a7c20d1 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 2 Dec 2016 17:38:33 -0500 Subject: [PATCH] Fix support for SOGoSieveFolderEncoding defaults Cont'd. Fixes #3904 --- NEWS | 1 + SoObjects/Mailer/SOGoMailAccount.h | 1 + SoObjects/Mailer/SOGoMailAccount.m | 12 +++++++++++- UI/PreferencesUI/UIxPreferences.m | 8 -------- UI/Templates/PreferencesUI/UIxFilterEditor.wox | 2 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 1 - .../js/Preferences/FiltersDialogController.js | 9 +-------- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/NEWS b/NEWS index e480e4fd7..a9da9eded 100644 --- a/NEWS +++ b/NEWS @@ -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) ------------------ diff --git a/SoObjects/Mailer/SOGoMailAccount.h b/SoObjects/Mailer/SOGoMailAccount.h index fd1f76056..83a03ad80 100644 --- a/SoObjects/Mailer/SOGoMailAccount.h +++ b/SoObjects/Mailer/SOGoMailAccount.h @@ -67,6 +67,7 @@ typedef enum { NSString *otherUsersFolderName; NSString *sharedFoldersName; NSMutableDictionary *subscribedFolders; + BOOL sieveFolderUTF8Encoding; } - (SOGoIMAPAclStyle) imapAclStyle; diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index c719fb069..133f5296a 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -37,6 +37,7 @@ #import #import #import +#import #import #import #import @@ -62,6 +63,7 @@ static NSString *inboxFolderName = @"INBOX"; { if ((self = [super init])) { + NSString *sieveFolderEncoding = [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding]; inboxFolder = nil; draftsFolder = nil; sentFolder = nil; @@ -72,6 +74,7 @@ static NSString *inboxFolderName = @"INBOX"; otherUsersFolderName = nil; sharedFoldersName = nil; subscribedFolders = nil; + sieveFolderUTF8Encoding = [sieveFolderEncoding isEqualToString: @"UTF-8"]; } return self; @@ -461,7 +464,7 @@ static NSString *inboxFolderName = @"INBOX"; 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; @@ -550,6 +553,13 @@ static NSString *inboxFolderName = @"INBOX"; 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]; } diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 28393873a..28f62d645 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1622,14 +1622,6 @@ static NSArray *reminderValues = nil; userCanChangePassword]; } -// -// Used wox by template -// -- (NSString *) sieveFolderEncoding -{ - return [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding]; -} - // - (NSString *) localeCode // { // // WARNING : NSLocaleCode is not defined in diff --git a/UI/Templates/PreferencesUI/UIxFilterEditor.wox b/UI/Templates/PreferencesUI/UIxFilterEditor.wox index ef9af8321..78d7bf560 100644 --- a/UI/Templates/PreferencesUI/UIxFilterEditor.wox +++ b/UI/Templates/PreferencesUI/UIxFilterEditor.wox @@ -146,7 +146,7 @@ - +
{{ item.name }}
diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index c6a64996b..b1c0efff3 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -21,7 +21,6 @@ var defaultEmailAddresses = ''; var forwardConstraints = ; var sieveCapabilities = ; - var sieveFolderEncoding = ;