diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index bfc654489..356155f84 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -932,21 +932,34 @@ iCalEvent *event; SOGoUser *ownerUser, *currentUser; NSArray *attendees; + NSCalendarDate *recurrenceId; if ([[context request] handledByDefaultHandler]) { ownerUser = [SOGoUser userWithLogin: owner roles: nil]; event = [self component: NO secure: NO]; - if (!occurence) - occurence = event; + + if (occurence == nil) + { + // No occurence specified; use the master event. + occurence = event; + recurrenceId = nil; + } + else + // Retrieve this occurence ID. + recurrenceId = [occurence recurrenceId]; + if ([event userIsOrganizer: ownerUser]) { - currentUser = [context activeUser]; // is this correct? + // The organizer deletes an occurence. + currentUser = [context activeUser]; attendees = [occurence attendeesWithoutUser: currentUser]; if (![attendees count] && event != occurence) attendees = [event attendeesWithoutUser: currentUser]; if ([attendees count]) { + // Remove the event from all attendees calendars + // and send them an email. [self _handleRemovedUsers: attendees]; [self sendEMailUsingTemplateNamed: @"Deletion" forObject: [occurence itipEntryWithMethod: @"cancel"] @@ -955,7 +968,9 @@ } } else if ([occurence userIsParticipant: ownerUser]) - [self changeParticipationStatus: @"DECLINED"]; + // The current user deletes the occurence; let the organizer know that + // the user has declined this occurence. + [self changeParticipationStatus: @"DECLINED" forRecurrenceId: recurrenceId]; } }