Skip to content

Commit

Permalink
Allow custom email to be one of the user's profile
Browse files Browse the repository at this point in the history
Fixes #3551
  • Loading branch information
cgx committed Oct 3, 2016
1 parent f0a368e commit b4676ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -16,6 +16,7 @@ Enhancements
- [web] added sort by arrival date in Mail module (#708)
- [web] restored "now" line in Calendar module
- [web] updated CKEditor to version 4.5.11
- [web] allow custom email address to be one of the user's profile (#3551)
- [eas] propagate message submission errors to EAS clients (#3774)

Bug fixes
Expand Down
18 changes: 15 additions & 3 deletions SoObjects/SOGo/SOGoUser.m
Expand Up @@ -626,11 +626,12 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat
*encryption, *scheme, *action, *query, *customEmail, *defaultEmail, *sieveServer;
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts, *mailSettings;
NSNumber *port;
NSMutableArray *identities;
NSArray *mails, *delegators, *delegates;
NSMutableArray *identities, *mails;
NSArray *delegators, *delegates;
NSURL *url, *cUrl;
unsigned int count, max, default_identity;
NSInteger defaultPort;
NSUInteger index;

[self userDefaults];

Expand Down Expand Up @@ -712,7 +713,7 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat
defaultEmail = [NSString stringWithFormat: @"%@@%@", [self loginInDomain], [self domain]];
default_identity = 0;
identities = [NSMutableArray new];
mails = [self allEmails];
mails = [NSMutableArray arrayWithArray: [self allEmails]];
[mailAccount setObject: [mails objectAtIndex: 0] forKey: @"name"];

replyTo = [_defaults mailReplyTo];
Expand All @@ -729,6 +730,17 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat
{
if ([customEmail length] == 0)
customEmail = [mails objectAtIndex: 0];
else if ([fullName length] == 0)
{
// Custom email but default fullname; if the custom email is
// one of the user's emails, remove the duplicated entry
index = [mails indexOfObject: customEmail];
if (index != NSNotFound)
{
[mails removeObjectAtIndex: index];
max--;
}
}

if ([fullName length] == 0)
{
Expand Down
7 changes: 3 additions & 4 deletions UI/PreferencesUI/UIxPreferences.m
Expand Up @@ -1860,10 +1860,9 @@ - (void) _extractMainIdentity: (NSDictionary *) identity
value = [[identity objectForKey: @"email"]
stringByTrimmingSpaces];

/* We make sure that the "custom" value is different from the values
returned by the user directory service. */
if ([value length] == 0
|| [[user allEmails] containsObject: value])
/* We make sure that the "custom" value is different from the system email */
if ([value length] == 0)
|| [[user systemEmail] isEqualToString: value])
value = nil;

if (value)
Expand Down

0 comments on commit b4676ce

Please sign in to comment.