diff --git a/NEWS b/NEWS index 911ebe1fe..41247a3ef 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Bug fixes - [core] handle properly mails using windows-1255 charset (#4124) - [core] properly honor the "include in freebusy" setting (#3354) - [core] make sure to use crypt scheme when encoding md5/sha256/sha512 (#4137) + - [web] fixed mail delegation of pristine user accounts (#4160) - [eas] fixed opacity in EAS freebusy (#4033) - [eas] set reply/forwarded flags when ReplaceMime is set (#4133) - [eas] remove alarms over EAS if we don't want them (#4059) diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index a915effe6..4b19c6c23 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -999,13 +999,20 @@ static NSString *inboxFolderName = @"INBOX"; - (void) _setDelegates: (NSArray *) newDelegates { + NSMutableDictionary *mailSettings; SOGoUser *ownerUser; SOGoUserSettings *settings; ownerUser = [SOGoUser userWithLogin: [self ownerInContext: context]]; settings = [ownerUser userSettings]; - [[settings objectForKey: @"Mail"] setObject: newDelegates - forKey: @"DelegateTo"]; + mailSettings = [settings objectForKey: @"Mail"]; + if (!mailSettings) + { + mailSettings = [NSMutableDictionary dictionaryWithCapacity: 1]; + [settings setObject: mailSettings forKey: @"Mail"]; + } + [mailSettings setObject: newDelegates + forKey: @"DelegateTo"]; [settings synchronize]; } diff --git a/SoObjects/Mailer/SOGoUser+Mailer.m b/SoObjects/Mailer/SOGoUser+Mailer.m index eafd83934..d82b2db4b 100644 --- a/SoObjects/Mailer/SOGoUser+Mailer.m +++ b/SoObjects/Mailer/SOGoUser+Mailer.m @@ -75,11 +75,18 @@ - (void) _setMailDelegators: (NSArray *) newDelegators { + NSMutableDictionary *mailSettings; SOGoUserSettings *settings; settings = [self userSettings]; - [[settings objectForKey: @"Mail"] setObject: newDelegators - forKey: @"DelegateFrom"]; + mailSettings = [settings objectForKey: @"Mail"]; + if (!mailSettings) + { + mailSettings = [NSMutableDictionary dictionaryWithCapacity: 1]; + [settings setObject: mailSettings forKey: @"Mail"]; + } + [mailSettings setObject: newDelegators + forKey: @"DelegateFrom"]; [settings synchronize]; }