Support multiple descriptions from LDAP entries

Fixes #3750
This commit is contained in:
Francis Lachapelle
2016-08-01 15:55:50 -04:00
parent 6071375c29
commit 9d65d7c3a8
6 changed files with 70 additions and 30 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
/* NGVCard+SOGo.h - this file is part of SOGo
*
* Copyright (C) 2009-2015 Inverse inc.
* Copyright (C) 2009-2016 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,6 +49,9 @@
- (NSString *) pager;
- (NSCalendarDate *) birthday;
- (void) setNotes: (NSArray *) newNotes;
- (NSArray *) notes;
@end
#endif /* NGVCARD_SOGO_H */
+40 -2
View File
@@ -1,6 +1,6 @@
/* NGVCard+SOGo.m - this file is part of SOGo
*
* Copyright (C) 2009-2015 Inverse inc.
* Copyright (C) 2009-2016 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -339,7 +339,11 @@ convention:
setSingleValue: [ldifRecord objectForKey: @"c_info"]
forKey: @""];
[self setNote: [ldifRecord objectForKey: @"description"]];
o = [ldifRecord objectForKey: @"description"];
if ([o isKindOfClass: [NSArray class]])
[self setNotes: o];
else
[self setNote: o];
o = [ldifRecord objectForKey: @"vcardcategories"];
@@ -851,6 +855,40 @@ convention:
return date;
}
- (void) setNotes: (NSArray *) newNotes
{
NSUInteger count, max;
max = [newNotes count];
for (count = 0; count < max; count++)
{
[self addChildWithTag: @"note"
types: nil
singleValue: [newNotes objectAtIndex: count]];
}
}
- (NSArray *) notes
{
NSArray *notes;
NSMutableArray *flattenedNotes;
NSString *note;
NSUInteger count, max;
notes = [self childrenWithTag: @"note"];
max = [notes count];
flattenedNotes = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
note = [[notes objectAtIndex: count] flattenedValuesForKey: @""];
[flattenedNotes addObject: note];
}
return flattenedNotes;
}
- (NSMutableDictionary *) quickRecordFromContent: (NSString *) theContent
container: (id) theContainer
{