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

This commit is contained in:
Ludovic Marcotte
2016-03-18 12:38:47 -04:00
parent e786dd8f2b
commit 00777fa7f3
3 changed files with 20 additions and 8 deletions
+14 -4
View File
@@ -28,6 +28,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>
@@ -282,7 +283,9 @@
data = @"";
[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])
@@ -344,15 +347,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;
}