From f8823f36a6de128a6a6e3b728f488d96d49344d8 Mon Sep 17 00:00:00 2001 From: mguessan Date: Sun, 26 Dec 2010 11:46:11 +0000 Subject: [PATCH] EWS: store X-MOZ-SEND-INVITATIONS property to fix no notification issue with Lightning git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1584 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../davmail/exchange/ews/EwsExchangeSession.java | 16 ++++++++++++++-- src/java/davmail/exchange/ews/Field.java | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index bf768621..3b1c1e43 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -1191,6 +1191,11 @@ public class EwsExchangeSession extends ExchangeSession { } else { updates.add(Field.createFieldUpdate("apptstateflags", "0")); } + // store mozilla invitations option + String xMozSendInvitations = vCalendar.getFirstVeventPropertyValue("X-MOZ-SEND-INVITATIONS"); + if (xMozSendInvitations != null) { + updates.add(Field.createFieldUpdate("xmozsendinvitations", xMozSendInvitations)); + } // handle mozilla alarm String xMozLastack = vCalendar.getFirstVeventPropertyValue("X-MOZ-LASTACK"); if (xMozLastack != null) { @@ -1270,6 +1275,7 @@ public class EwsExchangeSession extends ExchangeSession { getItemMethod.addAdditionalProperty(Field.get("optionalattendees")); getItemMethod.addAdditionalProperty(Field.get("xmozlastack")); getItemMethod.addAdditionalProperty(Field.get("xmozsnoozetime")); + getItemMethod.addAdditionalProperty(Field.get("xmozsendinvitations")); } executeMethod(getItemMethod); @@ -1292,21 +1298,27 @@ public class EwsExchangeSession extends ExchangeSession { VProperty attendeeProperty = new VProperty("ATTENDEE", "mailto:" + attendee.email); attendeeProperty.addParam("CN", attendee.name); attendeeProperty.addParam("PARTSTAT", attendee.partstat); + //attendeeProperty.addParam("RSVP", "TRUE"); attendeeProperty.addParam("ROLE", attendee.role); localVCalendar.addFirstVeventProperty(attendeeProperty); } } + // restore mozilla invitations option + localVCalendar.setFirstVeventPropertyValue("X-MOZ-SEND-INVITATIONS", + getItemMethod.getResponseItem().get(Field.get("xmozsendinvitations").getResponseName())); // 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())); + // overwrite method + // localVCalendar.setPropertyValue("METHOD", "REQUEST"); content = localVCalendar.toString().getBytes("UTF-8"); } catch (IOException e) { throw buildHttpException(e); } catch (MessagingException e) { - throw buildHttpException(e); + throw buildHttpException(e); } return content; } @@ -1575,7 +1587,7 @@ public class EwsExchangeSession extends ExchangeSession { } else { int end = line.lastIndexOf("\" selected>"); int start = line.lastIndexOf('\"', end - 1); - result = line.substring(start+1, end); + result = line.substring(start + 1, end); } } } catch (IOException e) { diff --git a/src/java/davmail/exchange/ews/Field.java b/src/java/davmail/exchange/ews/Field.java index f056c537..2491852c 100644 --- a/src/java/davmail/exchange/ews/Field.java +++ b/src/java/davmail/exchange/ews/Field.java @@ -200,6 +200,7 @@ public final class Field { FIELD_MAP.put("xmozlastack", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozlastack")); FIELD_MAP.put("xmozsnoozetime", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsnoozetime")); + FIELD_MAP.put("xmozsendinvitations", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsendinvitations")); // attachments FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments"));