diff --git a/SOPE/NGCards/CardElement.m b/SOPE/NGCards/CardElement.m index 6b103539f..5ae4feecb 100644 --- a/SOPE/NGCards/CardElement.m +++ b/SOPE/NGCards/CardElement.m @@ -244,8 +244,7 @@ NSMutableString *flattenedValues; NSString *encoding, *realValue, *value; - encoding = [[self value: 0 ofAttribute: @"encoding"] - lowercaseString]; + encoding = [[self value: 0 ofAttribute: @"encoding"] lowercaseString]; flattenedValues = [NSMutableString string]; diff --git a/SoObjects/Contacts/NGVCard+SOGo.h b/SoObjects/Contacts/NGVCard+SOGo.h index 12968cf75..6cfa13384 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.h +++ b/SoObjects/Contacts/NGVCard+SOGo.h @@ -1,6 +1,6 @@ /* NGVCard+SOGo.h - this file is part of SOGo * - * Copyright (C) 2009-2017 Inverse inc. + * Copyright (C) 2009-2020 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 @@ -56,6 +56,9 @@ - (void) setNotes: (NSArray *) newNotes; - (NSArray *) notes; +- (void) setTitles; +- (NSArray *) titles; + @end #endif /* NGVCARD_SOGO_H */ diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index d96b66cb3..0f7912b4c 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -1,6 +1,6 @@ /* NGVCard+SOGo.m - this file is part of SOGo * - * Copyright (C) 2009-2017 Inverse inc. + * Copyright (C) 2009-2020 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 @@ -310,7 +310,12 @@ convention: given: [ldifRecord objectForKey: @"givenname"] additional: nil prefixes: nil suffixes: nil]; [self setNickname: [ldifRecord objectForKey: @"mozillanickname"]]; - [self setTitle: [ldifRecord objectForKey: @"title"]]; + + o = [ldifRecord objectForKey: @"title"]; + if ([o isKindOfClass: [NSArray class]]) + [self setTitles: o]; + else + [self setTitle: o]; fn = [ldifRecord objectForKey: @"displayname"]; if (!fn) @@ -1001,6 +1006,42 @@ convention: return flattenedNotes; } +- (void) setTitles: (NSArray *) newTitles +{ + NSArray *elements; + NSUInteger count, max; + + elements = [self childrenWithTag: @"title"]; + [self removeChildren: elements]; + max = [newTitles count]; + for (count = 0; count < max; count++) + { + [self addChildWithTag: @"title" + types: nil + singleValue: [newTitles objectAtIndex: count]]; + } +} + +- (NSArray *) titles +{ + NSArray *titles; + NSMutableArray *flattenedTitles; + NSString *title; + NSUInteger count, max; + + titles = [self childrenWithTag: @"title"]; + max = [titles count]; + flattenedTitles = [NSMutableArray arrayWithCapacity: max]; + + for (count = 0; count < max; count++) + { + title = [[titles objectAtIndex: count] flattenedValuesForKey: @""]; + [flattenedTitles addObject: title]; + } + + return flattenedTitles; +} + - (NSMutableDictionary *) quickRecordFromContent: (NSString *) theContent container: (id) theContainer nameInContainer: (NSString *) nameInContainer diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index 7f551e577..21998231c 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -320,9 +320,9 @@ o = [card nickname]; if (o) [data setObject: o forKey: @"nickname"]; - o = [card title]; - if ([o length] > 0) - [data setObject: o forKey: @"title"]; + o = [card titles]; + if ([o count]) + [data setObject: [o componentsJoinedByString: @" / "] forKey: @"title"]; o = [card role]; if ([o length] > 0) [data setObject: o forKey: @"role"];