diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index 7c2fae5f..c125ab08 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -1117,6 +1117,15 @@ public class EwsExchangeSession extends ExchangeSession { } else { updates.add(Field.createFieldUpdate("apptstateflags", "0")); } + // handle mozilla alarm + String xMozLastack = vCalendar.getFirstVeventPropertyValue("X-MOZ-LASTACK"); + if (xMozLastack != null) { + updates.add(Field.createFieldUpdate("xmozlastack", xMozLastack)); + } + String xMozSnoozeTime = vCalendar.getFirstVeventPropertyValue("X-MOZ-SNOOZE-TIME"); + if (xMozSnoozeTime != null) { + updates.add(Field.createFieldUpdate("xmozsnoozetime", xMozSnoozeTime)); + } if (vCalendar.isMeeting()) { VCalendar.Recipients recipients = vCalendar.getRecipients(false); @@ -1184,6 +1193,8 @@ public class EwsExchangeSession extends ExchangeSession { getItemMethod.addAdditionalProperty(Field.get("calendaruid")); getItemMethod.addAdditionalProperty(Field.get("requiredattendees")); getItemMethod.addAdditionalProperty(Field.get("optionalattendees")); + getItemMethod.addAdditionalProperty(Field.get("xmozlastack")); + getItemMethod.addAdditionalProperty(Field.get("xmozsnoozetime")); executeMethod(getItemMethod); content = getItemMethod.getMimeContent(); @@ -1206,6 +1217,11 @@ public class EwsExchangeSession extends ExchangeSession { localVCalendar.addFirstVeventProperty(attendeeProperty); } } + // restore mozilla alarm status + localVCalendar.setFirstVeventPropertyValue("X-MOZ-LASTACK", + getItemMethod.getResponseItem().get(Field.get("xmozlastack").getResponseName())); + localVCalendar.setFirstVeventPropertyValue("X-MOZ-SNOOZE-TIME", + getItemMethod.getResponseItem().get(Field.get("xmozsnoozetime").getResponseName())); content = localVCalendar.toString().getBytes("UTF-8"); } catch (IOException e) { diff --git a/src/java/davmail/exchange/ews/Field.java b/src/java/davmail/exchange/ews/Field.java index f9065a8e..02684307 100644 --- a/src/java/davmail/exchange/ews/Field.java +++ b/src/java/davmail/exchange/ews/Field.java @@ -192,10 +192,12 @@ public class Field { FIELD_MAP.put("starttimezone", new UnindexedFieldURI("calendar:StartTimeZone")); FIELD_MAP.put("busystatus", new UnindexedFieldURI("calendar:LegacyFreeBusyStatus")); - FIELD_MAP.put("requiredattendees", new UnindexedFieldURI("calendar:RequiredAttendees")); FIELD_MAP.put("optionalattendees", new UnindexedFieldURI("calendar:OptionalAttendees")); + FIELD_MAP.put("xmozlastack", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozlastack")); + FIELD_MAP.put("xmozsnoozetime", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsnoozetime")); + // attachments FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments")); } diff --git a/src/java/davmail/exchange/ews/IndexedFieldUpdate.java b/src/java/davmail/exchange/ews/IndexedFieldUpdate.java index a5eb403b..896c025c 100644 --- a/src/java/davmail/exchange/ews/IndexedFieldUpdate.java +++ b/src/java/davmail/exchange/ews/IndexedFieldUpdate.java @@ -55,7 +55,7 @@ public class IndexedFieldUpdate extends FieldUpdate { StringBuilder buffer = new StringBuilder(); for (FieldUpdate fieldUpdate : updates) { - fieldUpdate.fieldURI.appendValue(buffer, itemType, fieldUpdate.value); + fieldUpdate.fieldURI.appendValue(buffer, null, fieldUpdate.value); } writer.write(buffer.toString());