diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index a6a8e260f..907612c47 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import #import +#import #import #import @@ -90,6 +91,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import #import #import +#import #import #import @@ -1862,6 +1864,7 @@ void handle_eas_terminate(int signum) { NSString *realCollectionId, *requestId, *easRequestId, *participationStatus, *calendarId; SOGoAppointmentObject *appointmentObject; + iCalAlarm *alarm = nil; SOGoMailObject *mailObject; NSMutableDictionary *uidCache, *folderMetadata; NSMutableString *s, *nameInCache; @@ -1959,6 +1962,9 @@ void handle_eas_terminate(int signum) event = [[calendar events] lastObject]; calendarId = [event uid]; + // We take the organizers's alarm to start with + alarm = [event firstSupportedAlarm]; + // Fetch the SOGoAppointmentObject collection = [[context activeUser] personalCalendarFolderInContext: context]; nameInCache = [NSString stringWithFormat: @"vevent/%@", [collection nameInContainer]]; @@ -1979,7 +1985,7 @@ void handle_eas_terminate(int signum) { appointmentObject = [[SOGoAppointmentObject alloc] initWithName: [NSString stringWithFormat: @"%@.ics", [event uid]] inContainer: collection]; - [appointmentObject saveComponent: event force: YES]; + [appointmentObject saveCalendar: [event parent]]; } if (uidCache && [calendarId length] > 64) @@ -2016,10 +2022,10 @@ void handle_eas_terminate(int signum) participationStatus = @"TENTATIVE"; else participationStatus = @"DECLINED"; - + [appointmentObject changeParticipationStatus: participationStatus withDelegate: nil - alarm: nil]; + alarm: alarm]; [s appendString: @""]; [s appendString: @""]; diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m index 3f909ef48..b4f35ad69 100644 --- a/ActiveSync/iCalEvent+ActiveSync.m +++ b/ActiveSync/iCalEvent+ActiveSync.m @@ -908,8 +908,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. component: (id) component { NSString *status; + iCalAlarm *alarm; + iCalPerson *attendee; id o; + + attendee = [self userAsAttendee: [context activeUser]]; + status = [attendee partStat]; + alarm = nil; + // See: https://msdn.microsoft.com/en-us/library/ee202290(v=exchg.80).aspx // // 0 == Free @@ -928,11 +935,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. else status = @"TENTATIVE"; - // There's no delegate in EAS - [(SOGoAppointmentObject *) component changeParticipationStatus: status - withDelegate: nil - alarm: nil]; } + + if ((o = [theValues objectForKey: @"Reminder"]) && [o length]) + { + if ([self hasAlarms]) + alarm = [[self firstSupportedAlarm] mutableCopy]; + else + alarm = [[iCalAlarm alloc] init]; + + [alarm takeActiveSyncValues: theValues inContext: context]; + + + } + + // There's no delegate in EAS + [(SOGoAppointmentObject *) component changeParticipationStatus: status + withDelegate: nil + alarm: alarm]; + RELEASE(alarm); } @end