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

View File

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

View File

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