1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Caldav: implement mozilla alarm flags X-MOZ-LASTACK and X-MOZ-SNOOZE-TIME over EWS

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1471 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-23 07:31:18 +00:00
parent 01775fcf3d
commit 74d85dc23a
3 changed files with 20 additions and 2 deletions

View File

@ -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) {

View File

@ -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"));
}

View File

@ -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());