From 7458bf8e37499573a34366fc71c15213e82ecd74 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 19 Dec 2008 19:49:07 +0000 Subject: [PATCH] Added the attendee to the parent's item attendees list Monotone-Parent: bac00846545ecbaa355017083f8a425f751077c7 Monotone-Revision: d0d94f5dbbc0725b57437eef5366686ec0842d97 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-12-19T19:49:07 Monotone-Branch: ca.inverse.sogo --- .../Appointments/SOGoAppointmentObject.m | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 0e7f756d9..2906d5cbb 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -783,15 +783,41 @@ else hasChanged = NO; } - else if (recurrenceId) { - // We must add a recurrence to a non-existing event -- simply retrieve + NSArray *attendees; + unsigned int i; + BOOL found; + + // We must add an occurence to a non-existing event -- simply retrieve // the event from the organizer's calendar if (ownerEventObject == nil) ownerEventObject = [self _lookupEvent: [newEvent uid] forUID: ownerUID]; - + newEvent = [ownerEventObject component: NO secure: NO]; + attendees = [newEvent attendees]; + found = NO; + + // We check if the attendee that was added to a single occurence is + // present in the master component. If not, we add it with a participation + // status set to "DECLINED" + for (i = 0; i < [attendees count]; i++) + { + if ([[attendees objectAtIndex: i] hasSameEmailAddress: person]) + { + found = YES; + break; + } + } + + if (!found) + { + [person setParticipationStatus: iCalPersonPartStatDeclined]; + [person setRsvp: @"TRUE"]; + [person setRole: @"REQ-PARTICIPANT"]; + [newEvent addToAttendees: person]; + [ownerEventObject saveContentString: [[newEvent parent] versitString]]; + } } // We generate the updated iCalendar file and we save it