From 2582979066452a4bdc0cb9624b7387a15fb8ab1c Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 1 Dec 2008 21:15:07 +0000 Subject: [PATCH] Monotone-Parent: 4804ccb0f75341fb484b9540603a55565d6e29e5 Monotone-Revision: c44d651c982e7aefb1a028f246dcc968eeefaa79 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-12-01T21:15:07 Monotone-Branch: ca.inverse.sogo --- .../Appointments/SOGoAppointmentObject.m | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) 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]; } }