Expose all email addresses in autocompletion

This change is immediately applicable to LDAP-based system address
books. However, personal SQL-based address books must have their quick
tables recreated. To do so, one must use sogo-tool to backup and restore
the user's data.

Resolves #3443, #3526
This commit is contained in:
Francis Lachapelle
2016-05-25 10:25:53 -04:00
parent 6dc80e1159
commit fd4b09428f
6 changed files with 103 additions and 28 deletions
+16 -2
View File
@@ -264,9 +264,23 @@ static NSArray *folderListingFields = nil;
data = [contactRecord objectForKey: @"c_mail"];
if ([data length])
{
NSArray *values;
NSDictionary *email;
email = [NSDictionary dictionaryWithObjectsAndKeys: @"pref", @"type", data, @"value", nil];
[contactRecord setObject: [NSArray arrayWithObject: email] forKey: @"emails"];
NSMutableArray *emails;
NSString *type, *value;
int i, max;
values = [data componentsSeparatedByString: @","];
max = [values count];
emails = [NSMutableArray arrayWithCapacity: max];
for (i = 0; i < max; i++)
{
type = (i == 0)? @"pref" : @"home";
value = [values objectAtIndex: i];
email = [NSDictionary dictionaryWithObjectsAndKeys: type, @"type", value, @"value", nil];
[emails addObject: email];
}
[contactRecord setObject: emails forKey: @"emails"];
}
else
{