Skip to content

Commit

Permalink
feat(mail): handle multiple mail identities
Browse files Browse the repository at this point in the history
If no custom identity exists, initialize the mail identities of the user
with all the user's email addresses (extracted from MailFieldNames).

For this code path to be executed, the user must not have any of the
following defaults keys:

  SOGoMailIdentities
  SOGoMailCustomFullName
  SOGoMailCustomEmail
  SOGoMailReplyTo
  SOGoMailSignature

Fixes #768, fixes #4602
  • Loading branch information
cgx committed Jun 26, 2020
1 parent 0354515 commit 11bbdee
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions SoObjects/SOGo/SOGoUser.m
Expand Up @@ -786,20 +786,28 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat

if (![identities count])
{
// Create a default identity
identity = [NSMutableDictionary dictionaryWithObjectsAndKeys:
fullName, @"fullName",
[self systemEmail], @"email", nil];
if (appendDeletegatedIdentities)
// Create an identity for each email address
max = [mails count];
for (count = 0; count < max; count++)
{
[identity setObject: [NSNumber numberWithBool: YES] forKey: @"isDefault"];
hasDefaultIdentity = YES;
}
else
{
[identity setObject: [NSNumber numberWithBool: YES] forKey: @"isReadOnly"];
identity = [NSMutableDictionary dictionaryWithObjectsAndKeys:
fullName, @"fullName",
[mails objectAtIndex: count], @"email", nil];
if (appendDeletegatedIdentities)
{
if (count == 0)
{
// First identity uses the system email -- mark it as the default
[identity setObject: [NSNumber numberWithBool: YES] forKey: @"isDefault"];
hasDefaultIdentity = YES;
}
}
else
{
[identity setObject: [NSNumber numberWithBool: YES] forKey: @"isReadOnly"];
}
[identities addObject: identity];
}
[identities addObject: identity];
}

/* identities from delegators */
Expand Down

0 comments on commit 11bbdee

Please sign in to comment.