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

Caldav: fix regressions and do not filter on outlookmessageclass

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1323 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-31 23:21:07 +00:00
parent bd687b813f
commit 20ca74fb88
3 changed files with 39 additions and 10 deletions

View File

@ -1957,7 +1957,7 @@ public abstract class ExchangeSession {
// Make sure invites have a proper subject line
// TODO: get current user attendee status, i18n
String subject = vCalendar.getFirstVevent().getPropertyValue("SUMMARY");
String subject = vCalendar.getFirstVeventPropertyValue("SUMMARY");
if (subject == null) {
subject = BundleMessage.format("MEETING_REQUEST");
}
@ -1982,7 +1982,15 @@ public abstract class ExchangeSession {
return null;
}
}
if (LOGGER.isDebugEnabled()) {
StringBuilder logBuffer = new StringBuilder("Sending notification");
if (recipients.attendees != null) {
logBuffer.append("to: ").append(recipients.attendees);
}
if (recipients.optionalAttendees != null) {
logBuffer.append("cc: ").append(recipients.optionalAttendees);
}
}
} else {
// need to parse attendees and organizer to build recipients
VCalendar.Recipients recipients = vCalendar.getRecipients(false);
@ -2017,7 +2025,7 @@ public abstract class ExchangeSession {
// Write a part of the message that contains the
// ICS description so that invites contain the description text
String description = vCalendar.getFirstVevent().getPropertyValue("DESCRIPTION");
String description = vCalendar.getFirstVeventPropertyValue("DESCRIPTION");
if (description != null && description.length() > 0) {
writer.writeHeader("Content-Type", "text/plain;\r\n" +
@ -2169,7 +2177,6 @@ public abstract class ExchangeSession {
and(or(isNull("instancetype"),
isEqualTo("instancetype", 1),
and(isEqualTo("instancetype", 0), dateCondition)),
isEqualTo("outlookmessageclass", "IPM.Appointment"),
privateCondition));
}

View File

@ -334,7 +334,7 @@ public class VCalendar extends VObject {
* @return X-CALENDARSERVER-ACCESS value
*/
protected String getCalendarServerAccess() {
String eventClass = firstVevent.getPropertyValue("CLASS");
String eventClass = getFirstVeventPropertyValue("CLASS");
if ("PRIVATE".equalsIgnoreCase(eventClass)) {
return "CONFIDENTIAL";
} else if ("CONFIDENTIAL".equalsIgnoreCase(eventClass)) {
@ -344,8 +344,29 @@ public class VCalendar extends VObject {
}
}
public VObject getFirstVevent() {
return firstVevent;
public String getFirstVeventPropertyValue(String name) {
if (firstVevent == null) {
return null;
} else {
return firstVevent.getPropertyValue(name);
}
}
protected VProperty getFirstVeventProperty(String name) {
if (firstVevent == null) {
return null;
} else {
return firstVevent.getProperty(name);
}
}
protected List<VProperty> getFirstVeventProperties(String name) {
if (firstVevent == null) {
return null;
} else {
return firstVevent.getProperties(name);
}
}
class Recipients {
@ -360,7 +381,7 @@ public class VCalendar extends VObject {
HashSet<String> optionalAttendees = new HashSet<String>();
// get recipients from first VEVENT
List<VProperty> attendeeProperties = firstVevent.getProperties("ATTENDEE");
List<VProperty> attendeeProperties = getFirstVeventProperties("ATTENDEE");
if (attendeeProperties != null) {
for (VProperty property : attendeeProperties) {
// exclude current user and invalid values from recipients
@ -389,9 +410,10 @@ public class VCalendar extends VObject {
}
}
Recipients recipients = new Recipients();
recipients.organizer = getEmailValue(firstVevent.getProperty("ORGANIZER"));
recipients.organizer = getEmailValue(getFirstVeventProperty("ORGANIZER"));
recipients.attendees = StringUtil.join(attendees, ", ");
recipients.optionalAttendees = StringUtil.join(optionalAttendees, ", ");
return recipients;
}
}

View File

@ -1268,7 +1268,7 @@ public class DavExchangeSession extends ExchangeSession {
event.getBody();
// getBody success => add event or task
events.add(event);
} catch (HttpException e) {
} catch (IOException e) {
// invalid event: exclude from list
LOGGER.warn("Invalid event " + event.displayName + " found at " + response.getHref(), e);
}