(fix) respect the LDAP attributes mapping in the list view

This commit is contained in:
Ludovic Marcotte
2016-03-18 12:37:21 -04:00
parent 7d383639b9
commit 5ae40a02ec
3 changed files with 20 additions and 8 deletions
+14 -4
View File
@@ -41,6 +41,7 @@
#import <SaxObjC/XMLNamespaces.h>
#import <SOGo/DOMNode+SOGo.h>
#import <SOGo/LDAPSource.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
@@ -257,7 +258,9 @@
}
[newRecord setObject: data forKey: @"c_mail"];
data = [oldRecord objectForKey: @"nsaimid"];
data = [oldRecord objectForKey: @"mozillanickname"];
if (![data length])
data = [oldRecord objectForKey: @"nsaimid"];
if (![data length])
data = [oldRecord objectForKey: @"nscpaimscreenname"];
if (![data length])
@@ -313,15 +316,22 @@
- (NSArray *) _flattenedRecords: (NSArray *) records
{
NSMutableDictionary *oldRecord;
NSMutableArray *newRecords;
NSEnumerator *oldRecords;
NSDictionary *oldRecord;
NSDictionary *o;
newRecords = [NSMutableArray arrayWithCapacity: [records count]];
oldRecords = [records objectEnumerator];
while ((oldRecord = [oldRecords nextObject]))
[newRecords addObject: [self _flattenedRecord: oldRecord]];
while ((o = [oldRecords nextObject]))
{
oldRecord = [NSMutableDictionary dictionary];
[oldRecord addEntriesFromDictionary: o];
if ([source isKindOfClass: [LDAPSource class]])
[(LDAPSource *)source applyContactMappingToResult: oldRecord];
[newRecords addObject: [self _flattenedRecord: oldRecord]];
}
return newRecords;
}