From 6a963bf84b02c9a6a5bcc90cd6e13025c914384e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 7 Mar 2017 10:45:44 -0500 Subject: [PATCH] (fix) remove attendees that have the same identity of the organizer (fixes #3905) --- .../Appointments/SOGoAppointmentObject.m | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 409fc4c123..62a7a5cc58 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1817,7 +1817,7 @@ - (void) _adjustEventsInRequestCalendar: (iCalCalendar *) rqCalendar { NSArray *allEvents; iCalEvent *event; - NSUInteger i; + NSUInteger i, j; allEvents = [rqCalendar events]; @@ -1850,12 +1850,27 @@ - (void) _adjustEventsInRequestCalendar: (iCalCalendar *) rqCalendar if (uid) { NSDictionary *defaultIdentity; + NSArray *allAttendees; + iCalPerson *attendee; SOGoUser *organizer; + organizer = [SOGoUser userWithLogin: uid]; defaultIdentity = [organizer defaultIdentity]; [[event organizer] setCn: [defaultIdentity objectForKey: @"fullName"]]; [[event organizer] setEmail: [defaultIdentity objectForKey: @"email"]]; + + // We now check if one of the attendee is also the organizer. If so, + // we remove it. See bug #3905 (https://sogo.nu/bugs/view.php?id=3905) + // for more details. This is a Calendar app bug on Apple Yosemite. + allAttendees = [event attendees]; + + for (j = [allAttendees count]-1; j >= 0; j--) + { + attendee = [allAttendees objectAtIndex: j]; + if ([organizer hasEmail: [attendee rfc822Email]]) + [event removeFromAttendees: attendee]; + } } } } @@ -2040,9 +2055,7 @@ - (NSException *) updateContentWithCalendar: (iCalCalendar *) calendar [self _decomposeGroupsInRequestCalendar: calendar]; if ([[ownerUser domainDefaults] iPhoneForceAllDayTransparency] && [rq isIPhone]) - { - [self _adjustTransparencyInRequestCalendar: calendar]; - } + [self _adjustTransparencyInRequestCalendar: calendar]; [self _adjustEventsInRequestCalendar: calendar]; [self adjustClassificationInRequestCalendar: calendar];