From 8e0cca45cb01b608eb3ba3c5cd841764ab699594 Mon Sep 17 00:00:00 2001 From: Zdenek Devaty Date: Fri, 17 May 2024 08:12:11 +0200 Subject: [PATCH] Warn about recurring events Recurring events will be complex to get right, so we will not support them at all in initial version. --- USER-GUIDE.md | 4 ++++ ews/ews.go | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/USER-GUIDE.md b/USER-GUIDE.md index 6d0ee41..785a276 100644 --- a/USER-GUIDE.md +++ b/USER-GUIDE.md @@ -150,3 +150,7 @@ If the booking is made by a user without Exchange account (or an Ad-hoc booking) ## Booking Timing When creating or deleting a booking from Eliona, the booking will be visible in Outlook in a few seconds. Changes made in Outlook are synchronized to Eliona every `refreshInterval` seconds. + +## Recurring events + +For technical reasons, recurring events are not yet supported. diff --git a/ews/ews.go b/ews/ews.go index 66bc6f0..db67e63 100644 --- a/ews/ews.go +++ b/ews/ews.go @@ -258,6 +258,7 @@ type calendarItem struct { Start time.Time `xml:"Start"` End time.Time `xml:"End"` Organizer organizer `xml:"Organizer"` + CalendarItemType string `xml:"CalendarItemType"` } type itemId struct { @@ -300,6 +301,7 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new + @@ -342,6 +344,11 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new return nil, nil, nil, syncState, fmt.Errorf("resolving distinguished name '%s': %v", item.Organizer.Mailbox.EmailAddress, err) } + if change.CalendarItem.CalendarItemType == "RecurringMaster" { + log.Warn("EWS", "A recurring event was created for %s by %s. Recurring events are not supported!", roomEmail, organizerEmail) + continue + } + new = append(new, model.Booking{ ExchangeIDInResourceMailbox: item.ItemId.Id, ExchangeUID: item.UID, @@ -363,6 +370,11 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new return nil, nil, nil, syncState, fmt.Errorf("resolving distinguished name '%s': %v", item.Organizer.Mailbox.EmailAddress, err) } + if change.CalendarItem.CalendarItemType == "RecurringMaster" { + log.Warn("EWS", "A recurring event was updated for %s by %s. Recurring events are not supported!", roomEmail, organizerEmail) + continue + } + updated = append(updated, model.Booking{ ExchangeIDInResourceMailbox: item.ItemId.Id, ExchangeUID: item.UID,