diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index a5c394319..d688a256b 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -3328,7 +3328,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir else { // If the start date is a "floating time", let's use the user's timezone - // during the import for both the start and end dates. + // during the import for both the start and end dates. This is similar + // to what we do in SOGoAppointmentObject: -_adjustFloatingTimeInRequestCalendar: NSString *s; s = [[startDate valuesAtIndex: 0 forKey: @""] objectAtIndex: 0]; diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index f1fa70774..8a751b471 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1857,6 +1857,54 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent } } +// +// This is similar to what we do in SOGoAppointmentFolder: -importCalendar: +// +- (void) _adjustFloatingTimeInRequestCalendar: (iCalCalendar *) rqCalendar +{ + iCalDateTime *startDate, *endDate; + NSString *startDateAsString; + SOGoUserDefaults *ud; + NSArray *allEvents; + iCalTimeZone *tz; + iCalEvent *event; + int i, delta; + + allEvents = [rqCalendar events]; + for (i = 0; i < [allEvents count]; i++) + { + event = [allEvents objectAtIndex: i]; + + if ([event isAllDay]) + continue; + + startDate = (iCalDateTime *)[event uniqueChildWithTag: @"dtstart"]; + startDateAsString = [[startDate valuesAtIndex: 0 forKey: @""] objectAtIndex: 0]; + + if (![startDate timeZone] && + ![startDateAsString hasSuffix: @"Z"] && + ![startDateAsString hasSuffix: @"z"]) + { + ud = [[context activeUser] userDefaults]; + tz = [iCalTimeZone timeZoneForName: [ud timeZoneName]]; + if ([rqCalendar addTimeZone: tz]) + { + delta = [[tz periodForDate: [startDate dateTime]] secondsOffsetFromGMT]; + + [event setStartDate: [[event startDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]]; + [startDate setTimeZone: tz]; + + endDate = (iCalDateTime *) [event uniqueChildWithTag: @"dtend"]; + if (endDate) + { + [event setEndDate: [[event endDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]]; + [endDate setTimeZone: tz]; + } + } + } + } +} + - (void) _decomposeGroupsInRequestCalendar: (iCalCalendar *) rqCalendar { NSArray *allEvents; @@ -1980,6 +2028,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent [self _adjustEventsInRequestCalendar: calendar]; [self adjustClassificationInRequestCalendar: calendar]; [self _adjustPartStatInRequestCalendar: calendar]; + [self _adjustFloatingTimeInRequestCalendar: calendar]; } //