From 5b59ebfe1119c65a238546d46413f0a517681bf9 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 25 Apr 2012 21:32:18 +0000 Subject: [PATCH] Monotone-Parent: d8a0de208631b406144e740ab09b4e5a92f0e66c Monotone-Revision: 4d091aae297e1a3ea2ef11b35c1df5c2c60c6fea Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-04-25T21:32:18 --- ChangeLog | 7 +++++++ SoObjects/SOGo/SOGoUser.m | 19 +++++++++++-------- UI/PreferencesUI/UIxPreferences.m | 20 +++++++++----------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 481de2beb..13895f263 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2012-04-25 Wolfgang Sourdeau + * UI/PreferencesUI/UIxPreferences.m (_extractMainIdentity:): save + the custom full name even when the configured custom email has the + same value as the system value. + + * SoObjects/SOGo/SOGoUser.m (-appendSystemMailAccount): append + custom identity even though only the full name has a custom value. + * SoObjects/Mailer/SOGoDraftObject.m (-bodyPartForAttachmentWithName:): force conversion of rfc822 content to quoted-printable, since it would otherwise risk passing diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 75699eaae..6a6f7b7b3 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -577,7 +577,7 @@ - (void) _appendSystemMailAccount { NSString *fullName, *replyTo, *imapLogin, *imapServer, *signature, - *encryption, *scheme, *action, *query, *customValue; + *encryption, *scheme, *action, *query, *customEmail; NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts; NSNumber *port; NSMutableArray *identities; @@ -652,19 +652,22 @@ if ([[self domainDefaults] mailCustomFromEnabled]) { [self userDefaults]; - customValue = [_defaults mailCustomEmail]; - if ([customValue length] > 0) + customEmail = [_defaults mailCustomEmail]; + fullName = [_defaults mailCustomFullName]; + if ([customEmail length] > 0 || [fullName length] > 0) { - identity = [NSMutableDictionary new]; - [identity setObject: customValue forKey: @"email"]; + if ([customEmail length] == 0) + customEmail = [mails objectAtIndex: 0]; - fullName = [_defaults mailCustomFullName]; - if (![fullName length]) + if ([fullName length] == 0) { fullName = [self cn]; - if (![fullName length]) + if ([fullName length] == 0) fullName = login; } + + identity = [NSMutableDictionary new]; + [identity setObject: customEmail forKey: @"email"]; [identity setObject: fullName forKey: @"fullName"]; if ([replyTo length] > 0) diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index c1a3bd1ba..a772fbb40 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1297,17 +1297,15 @@ returned by the user directory service. */ if ([value length] == 0 || [[user allEmails] containsObject: value]) - { - [userDefaults setMailCustomEmail: nil]; - [userDefaults setMailCustomFullName: nil]; - } - else - { - [userDefaults setMailCustomEmail: value]; - value = [[identity objectForKey: @"fullName"] - stringByTrimmingSpaces]; - [userDefaults setMailCustomFullName: value]; - } + value = nil; + [userDefaults setMailCustomEmail: value]; + + value = [[identity objectForKey: @"fullName"] + stringByTrimmingSpaces]; + if ([value length] == 0 + || [[user cn] isEqualToString: value]) + value = nil; + [userDefaults setMailCustomFullName: value]; } value = [[identity objectForKey: @"replyTo"]