From 7c3df9f6500d8ec7968d8bf9b2a7b18564ffe23e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 18 Feb 2019 15:27:34 -0500 Subject: [PATCH] (fix) changes to contacts are now propagated to lists (fixes #850, #4301, #4617) --- NEWS | 1 + SOPE/NGCards/NGVCardReference.m | 4 +-- SOPE/NGCards/NGVList.h | 4 +-- SOPE/NGCards/NGVList.m | 4 +-- SoObjects/Contacts/SOGoContactGCSEntry.m | 39 ++++++++++++++++++++++- SoObjects/Contacts/SOGoContactGCSFolder.m | 2 +- SoObjects/Contacts/SOGoContactGCSList.m | 2 +- 7 files changed, 44 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 0f9fdea5b..176214812 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ Bug fixes - [web] fixed saving of email address for external calendar notifications (#4630) - [core] ignore transparent events in time conflict validation (#4539) - [core] fixed yearly recurrence calculator when starting from previous year + - [core] changes to contacts are now propagated to lists (#850, #4301, #4617) 4.0.5 (2019-01-09) ------------------ diff --git a/SOPE/NGCards/NGVCardReference.m b/SOPE/NGCards/NGVCardReference.m index 389fcba7f..059ae03f7 100644 --- a/SOPE/NGCards/NGVCardReference.m +++ b/SOPE/NGCards/NGVCardReference.m @@ -1,8 +1,6 @@ /* NGVCardReference.m - this file is part of NGCards * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2019 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 diff --git a/SOPE/NGCards/NGVList.h b/SOPE/NGCards/NGVList.h index 9bd10c5e9..b3b0ddd9a 100644 --- a/SOPE/NGCards/NGVList.h +++ b/SOPE/NGCards/NGVList.h @@ -1,8 +1,6 @@ /* NGVList.h - this file is part of NGCards * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2019 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 diff --git a/SOPE/NGCards/NGVList.m b/SOPE/NGCards/NGVList.m index d69bb9464..6301131b4 100644 --- a/SOPE/NGCards/NGVList.m +++ b/SOPE/NGCards/NGVList.m @@ -1,8 +1,6 @@ /* NGVList.m - this file is part of NGCards * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2019 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 diff --git a/SoObjects/Contacts/SOGoContactGCSEntry.m b/SoObjects/Contacts/SOGoContactGCSEntry.m index 1dec80ebd..3bae22db1 100644 --- a/SoObjects/Contacts/SOGoContactGCSEntry.m +++ b/SoObjects/Contacts/SOGoContactGCSEntry.m @@ -1,6 +1,6 @@ /* SOGoContactGCSEntry.m - this file is part of SOGo * - * Copyright (C) 2006-2017 Inverse inc. + * Copyright (C) 2006-2019 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 @@ -21,9 +21,15 @@ #import #import +#import +#import + +#import #import "NGVCard+SOGo.h" #import "SOGoContactEntryPhoto.h" +#import "SOGoContactGCSFolder.h" +#import "SOGoContactGCSList.h" #import "SOGoContactGCSEntry.h" @@ -182,7 +188,14 @@ - (NSException *) saveComponent: (NGVCard *) newCard baseVersion: (unsigned int) newVersion { + NSArray *lists, *references; + NGVCardReference *reference; + SOGoContactGCSList *list; + EOQualifier *qualifier; NSException *ex; + NGVList *vlist; + + int i, j; // We make sure new cards always have a UID - see #3819 if (![[newCard uid] length]) @@ -192,6 +205,30 @@ [card release]; card = nil; + // We now check if we must update lisst where this contact is present + qualifier = [EOQualifier qualifierWithQualifierFormat: @"c_component = 'vlist'"]; + lists = [[self container] lookupContactsWithQualifier: qualifier]; + + for (i = 0; i < [lists count]; i++) + { + list = [[self container] lookupName: [[lists objectAtIndex: i] objectForKey: @"c_name"] + inContext: context + acquire: NO]; + vlist = [list vList]; + references = [vlist cardReferences]; + + for (j = 0; j < [references count]; j++) + { + reference = [references objectAtIndex: j]; + if ([[self nameInContainer] isEqualToString: [reference reference]]) + { + [reference setFn: [newCard fn]]; + [reference setEmail: [newCard preferredEMail]]; + [list save]; + } + } + } + return ex; } diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index bcbe2c70b..945ddd7a8 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2017 Inverse inc. + Copyright (C) 2006-2019 Inverse inc. This file is part of SOGo. diff --git a/SoObjects/Contacts/SOGoContactGCSList.m b/SoObjects/Contacts/SOGoContactGCSList.m index 28ada8c3e..dffccc2e5 100644 --- a/SoObjects/Contacts/SOGoContactGCSList.m +++ b/SoObjects/Contacts/SOGoContactGCSList.m @@ -1,6 +1,6 @@ /* SOGoContactGCSList.m - this file is part of SOGo * - * Copyright (C) 2008-2014 Inverse inc. + * Copyright (C) 2008-2019 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