diff --git a/ChangeLog b/ChangeLog index c6a9f669f..c4fd0bfa7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-01 Ludovic Marcotte + + * SoObjects/Appointments/SOGoAppointmentObject.m + ([SOGoAppointmentObject -PUTAction:]): Slightly optimized + and we now consider the "X-SOGo: NoGroupsDecomposition" + special header. + 2009-04-30 Ludovic Marcotte * Added SoObjects/SOGo/SOGoGroup.{h.m} and diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 79b3a0d19..145a9f06c 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1325,10 +1325,15 @@ SOGoGroup *group; iCalEvent *event; WORequest *rq; + + BOOL b; int i; rq = [_ctx request]; + if ([[rq headersForKey: @"X-SOGo"] containsObject: @"NoGroupsDecomposition"]) + return [super PUTAction: _ctx]; + //NSLog(@"Content from request: %@", [rq contentAsString]); // The algorithm is pretty straightforward: @@ -1340,6 +1345,7 @@ // calendar = [iCalCalendar parseSingleFromSource: [rq contentAsString]]; allEvents = [calendar events]; + b = NO; for (i = 0; i < [allEvents count]; i++) { @@ -1359,6 +1365,7 @@ // We did decompose a group... [array removeObject: currentAttendee]; + b = YES; members = [group members]; for (i = 0; i < [members count]; i++) @@ -1387,7 +1394,12 @@ //NSLog(@"Content from calendar:secure: %@", [calendar versitString]); - [rq setContent: [[calendar versitString] dataUsingEncoding: [rq contentEncoding]]]; + // If we decomposed at least one group, let's rewrite the content + // of the request. Otherwise, leave it as is in case this rewrite + // isn't totaly lossless. + if (b) + [rq setContent: [[calendar versitString] dataUsingEncoding: [rq contentEncoding]]]; + return [super PUTAction: _ctx]; }