From 1ec53a063c72ba23f9b8481b49c5d987bd64d134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Vall=C3=A9s?= Date: Thu, 28 May 2015 14:47:07 +0200 Subject: [PATCH] oc-calendar: Improve check for appointment updates The UID was being used to check if the changes in an appointment had been made by its organiser. In this case, the UID is the user name, without taking the domain into account. The `owner` variable, however, is a full email address, so the comparison was never successful. This caused the update notification mail not to be sent. --- .../Appointments/SOGoAppointmentObject.m | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 64baf52d7..ca18b0271 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -2106,32 +2106,23 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent // if ([[newEvent attendees] count] || [[oldEvent attendees] count]) { - NSString *uid; - + BOOL userIsOrganizer; + // newEvent might be nil here, if we're deleting a RECURRENCE-ID with attendees - // If that's the case, we use the oldEvent for now just to obtain the organizer - // and we'll swap it back to nil once we're done. - if (!newEvent) - newEvent = oldEvent; - - // We fetch the organizer's uid. Sometimes, the recurrence-id will - // have it, sometimes not. If it doesn't, we fetch it from the master event. - uid = [[newEvent organizer] uid]; - - if (!uid && !recurrenceId) - uid = [[[[[newEvent parent] events] objectAtIndex: 0] organizer] uid]; - + // If that's the case, we use the oldEvent to obtain the organizer + if (newEvent) + userIsOrganizer = [newEvent userIsOrganizer: ownerUser]; + else + userIsOrganizer = [oldEvent userIsOrganizer: ownerUser]; + // With Thunderbird 10, if you create a recurring event with an exception // occurence, and invite someone, the PUT will have the organizer in the // recurrence-id and not in the master event. We must fix this, otherwise // SOGo will break. if (!recurrenceId && ![[[[[newEvent parent] events] objectAtIndex: 0] organizer] uid]) [[[[newEvent parent] events] objectAtIndex: 0] setOrganizer: [newEvent organizer]]; - - if (newEvent == oldEvent) - newEvent = nil; - - if (uid && [uid caseInsensitiveCompare: owner] == NSOrderedSame) + + if (userIsOrganizer) { // A RECCURENCE-ID was removed if (!newEvent && oldEvent)