From 0c0cbc19f0d8c14952cd76c4f933864020e607ce Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 19 Apr 2012 16:29:43 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: f90d169fbc251326ea6c8a2f620e125a8a7b4168 Monotone-Revision: 5af155533446328556c907456566939affd0ae8f Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2012-04-19T16:29:43 --- ChangeLog | 8 +++++++ .../Appointments/SOGoAppointmentObject.m | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a45532c7f..6f351b9f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-04-19 Ludovic Marcotte + + * SoObjects/Appointments/SOGoAppointmentObject.m (-PUTAction:) + We now handle cases where the last attendee AND the organizer + is removed from the event during a PUT action (happens when + you delete the last attendee of an event with iCal). This used + to crash sogod. + 2012-04-19 Francis Lachapelle * SoObjects/Appointments/SOGoAppointmentFolder.m diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index a06c7d263..447c33f9c 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -657,7 +657,7 @@ // +------------> _handleUpdatedEvent:fromOldEvent: ---> _addOrUpdateEvent:forUID:owner: <-----------+ // | | ^ | // v v | | -// _handleRemoveUsers:withRecurrenceId: _handleSequenceUpdateInEvent:ignoringAttendees:fromOldEvent: | +// _handleRemovedUsers:withRecurrenceId: _handleSequenceUpdateInEvent:ignoringAttendees:fromOldEvent: | // | | // | [DELETEAction:] | // | | {_handleAdded/Updated...}<--+ | @@ -1883,10 +1883,22 @@ withDelegate: nil // FIXME (specify delegate?) forRecurrenceId: [self _addedExDate: oldEvent newEvent: newEvent]]; } - else - [self changeParticipationStatus: [attendee partStat] - withDelegate: delegate - forRecurrenceId: recurrenceId]; + else if (attendee) + { + [self changeParticipationStatus: [attendee partStat] + withDelegate: delegate + forRecurrenceId: recurrenceId]; + } + // All attendees and the organizer field were removed. Apple iCal does + // that when we remove the last attendee of an event. + // + // We must update previous's attendees' calendars to actually + // remove the event in each of them. + else + { + [self _handleRemovedUsers: [changes deletedAttendees] + withRecurrenceId: recurrenceId]; + } } } }