mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-26 05:45:24 +00:00
Avoid inserting second email for Contacts
When we have a contact with an email, avoid generating another one with SOGoMailDomain value (normally we ended up with a contact with two identical emails on 'emails' key and for multidomain source we would had ended up with an email @localhost)
This commit is contained in:
committed by
Carlos Pérez-Aradros Herce
parent
08f57f6ad5
commit
8cfb0f0d44
@@ -749,21 +749,19 @@ static Class NSNullK;
|
||||
SOGoDomainDefaults *dd;
|
||||
|
||||
domain = [contact objectForKey: @"c_domain"];
|
||||
if ([domain length])
|
||||
dd = [SOGoDomainDefaults defaultsForDomain: domain];
|
||||
else
|
||||
dd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
dd = [SOGoDomainDefaults defaultsForDomain: domain];
|
||||
emails = [contact objectForKey: @"emails"];
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
if ([uid rangeOfString: @"@"].location == NSNotFound)
|
||||
systemEmail
|
||||
= [NSString stringWithFormat: @"%@@%@", uid, [dd mailDomain]];
|
||||
else
|
||||
systemEmail = uid;
|
||||
|
||||
// We always add the system email, which will always be returned
|
||||
// by SOGoUser -systemEmail.
|
||||
[emails addObject: systemEmail];
|
||||
if ([emails count] == 0)
|
||||
{
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
if ([uid rangeOfString: @"@"].location == NSNotFound)
|
||||
systemEmail = [NSString stringWithFormat: @"%@@%@", uid, [dd mailDomain]];
|
||||
else
|
||||
systemEmail = uid;
|
||||
// We always add the system email, which will always be returned
|
||||
// by SOGoUser -systemEmail.
|
||||
[emails addObject: systemEmail];
|
||||
}
|
||||
[contact setObject: [emails objectAtIndex: 0] forKey: @"c_email"];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user