diff --git a/ChangeLog b/ChangeLog index cb659ba13..7753ade77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-08-06 Wolfgang Sourdeau + * UI/PreferencesUI/UIxPreferences.m (_extractAuxiliaryAccounts:): + since we no longer transfer the user password to the client, the + old password has to be fetched from the old account unless a new + password has been set. + (-mailAccounts): we now strip the passwords from the returned mail + accounts, to avoid transferring them uselessly with a risk of + keeping them in cache. + * UI/WebServerResources/MailerUI.js: (initMailboxTree): make use of the new class below and drop all code related to keeping track of active requests. diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 8205a3d52..928c69956 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1152,7 +1152,7 @@ - (BOOL) _validateAccount: (NSDictionary *) account { static NSString *accountKeys[] = { @"name", @"serverName", @"userName", - @"password", nil }; + nil }; static NSArray *knownKeys = nil; NSMutableDictionary *clone; NSString **key, *value; @@ -1203,9 +1203,15 @@ - (void) _extractAuxiliaryAccounts: (NSArray *) accounts { - int count, max; + int count, max, oldMax; + NSArray *oldAccounts; NSMutableArray *auxAccounts; - NSDictionary *account; + NSDictionary *oldAccount; + NSMutableDictionary *account; + NSString *password; + + oldAccounts = [user mailAccounts]; + oldMax = [oldAccounts count]; max = [accounts count]; auxAccounts = [NSMutableArray arrayWithCapacity: max]; @@ -1214,7 +1220,21 @@ { account = [accounts objectAtIndex: count]; if ([self _validateAccount: account]) - [auxAccounts addObject: account]; + { + password = [account objectForKey: @"password"]; + if (!password) + { + if (count < oldMax) + { + oldAccount = [oldAccounts objectAtIndex: count]; + password = [oldAccount objectForKey: @"password"]; + } + if (!password) + password = @""; + [account setObject: password forKey: @"password"]; + } + [auxAccounts addObject: account]; + } } [userDefaults setAuxiliaryMailAccounts: auxAccounts]; @@ -1235,7 +1255,7 @@ { [self _extractMainSignature: [accounts objectAtIndex: 0]]; - if (max > 1 && [self mailAuxiliaryUserAccountsEnabled]) + if ([self mailAuxiliaryUserAccountsEnabled]) [self _extractAuxiliaryAccounts: accounts]; } } @@ -1244,8 +1264,16 @@ - (NSString *) mailAccounts { NSArray *accounts; + NSMutableDictionary *account; + int count, max; accounts = [user mailAccounts]; + max = [accounts count]; + for (count = 0; count < max; count++) + { + account = [accounts objectAtIndex: count]; + [account removeObjectForKey: @"password"]; + } return [accounts jsonRepresentation]; }