mirror of
https://github.com/moparisthebest/davmail
synced 2025-03-01 01:41:52 -05:00
Caldav: Fixed regression in allday event handling
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1455 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
82eb331997
commit
904adf7d20
@ -54,7 +54,7 @@ public class VCalendar extends VObject {
|
||||
}
|
||||
this.email = email;
|
||||
// set OWA timezone information
|
||||
if (this.vTimezone == null) {
|
||||
if (this.vTimezone == null && vTimezone != null) {
|
||||
this.vObjects.add(0, vTimezone);
|
||||
this.vTimezone = vTimezone;
|
||||
}
|
||||
@ -239,17 +239,19 @@ public class VCalendar extends VObject {
|
||||
}
|
||||
|
||||
protected void setServerAllday(VProperty property) {
|
||||
// set TZID param
|
||||
if (!property.hasParam("TZID")) {
|
||||
property.addParam("TZID", vTimezone.getPropertyValue("TZID"));
|
||||
if (vTimezone != null) {
|
||||
// set TZID param
|
||||
if (!property.hasParam("TZID")) {
|
||||
property.addParam("TZID", vTimezone.getPropertyValue("TZID"));
|
||||
}
|
||||
// remove VALUE
|
||||
property.removeParam("VALUE");
|
||||
String value = property.getValue();
|
||||
if (value.length() != 8) {
|
||||
LOGGER.warn("Invalid date value in allday event: " + value);
|
||||
}
|
||||
property.setValue(property.getValue() + "T000000");
|
||||
}
|
||||
// remove VALUE
|
||||
property.removeParam("VALUE");
|
||||
String value = property.getValue();
|
||||
if (value.length() != 8) {
|
||||
LOGGER.warn("Invalid date value in allday event: " + value);
|
||||
}
|
||||
property.setValue(property.getValue() + "T000000");
|
||||
}
|
||||
|
||||
protected void setClientAllday(VProperty property) {
|
||||
@ -423,7 +425,7 @@ public class VCalendar extends VObject {
|
||||
|
||||
public void removeVAlarm() {
|
||||
if (vObjects != null) {
|
||||
for (VObject vObject:vObjects) {
|
||||
for (VObject vObject : vObjects) {
|
||||
if ("VEVENT".equals(vObject.type)) {
|
||||
if (vObject.vObjects != null) {
|
||||
vObject.vObjects = null;
|
||||
@ -435,7 +437,7 @@ public class VCalendar extends VObject {
|
||||
|
||||
public boolean hasVAlarm() {
|
||||
if (vObjects != null) {
|
||||
for (VObject vObject:vObjects) {
|
||||
for (VObject vObject : vObjects) {
|
||||
if ("VEVENT".equals(vObject.type)) {
|
||||
if (vObject.vObjects != null) {
|
||||
return true;
|
||||
|
@ -375,20 +375,8 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
*/
|
||||
protected byte[] getContent(ItemId itemId) throws IOException {
|
||||
GetItemMethod getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
|
||||
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
|
||||
executeMethod(getItemMethod);
|
||||
byte[] mimeContent = getItemMethod.getMimeContent();
|
||||
VCalendar vCalendar = new VCalendar(mimeContent, email, getVTimezone());
|
||||
// remove additional reminder
|
||||
if (!"true".equals(getItemMethod.getResponseItem().get(Field.get("reminderset").getResponseName()))) {
|
||||
vCalendar.removeVAlarm();
|
||||
}
|
||||
String calendaruid = getItemMethod.getResponseItem().get(Field.get("calendaruid").getResponseName());
|
||||
if (calendaruid != null) {
|
||||
vCalendar.setFirstVeventPropertyValue("UID", calendaruid);
|
||||
}
|
||||
return vCalendar.toString().getBytes("UTF-8");
|
||||
return getItemMethod.getMimeContent();
|
||||
}
|
||||
|
||||
protected Message buildMessage(EWSMethod.Item response) throws DavMailException {
|
||||
@ -1146,10 +1134,25 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
public byte[] getEventContent() throws IOException {
|
||||
byte[] content;
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Get event: " + folderPath + '/' + itemName);
|
||||
LOGGER.debug("Get event: " + itemName);
|
||||
}
|
||||
try {
|
||||
content = getContent(itemId);
|
||||
GetItemMethod getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
|
||||
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
|
||||
executeMethod(getItemMethod);
|
||||
content = getItemMethod.getMimeContent();
|
||||
VCalendar vCalendar = new VCalendar(content, email, getVTimezone());
|
||||
// remove additional reminder
|
||||
if (!"true".equals(getItemMethod.getResponseItem().get(Field.get("reminderset").getResponseName()))) {
|
||||
vCalendar.removeVAlarm();
|
||||
}
|
||||
String calendaruid = getItemMethod.getResponseItem().get(Field.get("calendaruid").getResponseName());
|
||||
if (calendaruid != null) {
|
||||
vCalendar.setFirstVeventPropertyValue("UID", calendaruid);
|
||||
}
|
||||
content = vCalendar.toString().getBytes("UTF-8");
|
||||
|
||||
} catch (IOException e) {
|
||||
throw buildHttpException(e);
|
||||
}
|
||||
@ -1353,7 +1356,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
timezoneId = item.get("timezone");
|
||||
}
|
||||
} else {
|
||||
getTimezoneidFromOptions();
|
||||
timezoneId = getTimezoneidFromOptions();
|
||||
}
|
||||
if (timezoneId != null) {
|
||||
createCalendarFolder("davmailtemp", null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user