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

Fix empty organizer field in ICS (active sync support) and another getParticipants bug

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@613 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-07-08 22:51:34 +00:00
parent 3144b001d3
commit 5f76f05c64

View File

@ -643,7 +643,7 @@ public class ExchangeSession {
} }
public MessageList getAllMessageUidAndSize(String folderName) throws IOException { public MessageList getAllMessageUidAndSize(String folderName) throws IOException {
return searchMessages(folderName, "\"DAV:uid\", \"http://schemas.microsoft.com/mapi/proptag/x0e080003\"", ""); return searchMessages(folderName, "\"DAV:uid\", \"http://schemas.microsoft.com/mapi/proptag/x0e080003\"", "");
} }
public MessageList searchMessages(String folderName, String conditions) throws IOException { public MessageList searchMessages(String folderName, String conditions) throws IOException {
@ -657,7 +657,7 @@ public class ExchangeSession {
public MessageList searchMessages(String folderName, String attributes, String conditions) throws IOException { public MessageList searchMessages(String folderName, String attributes, String conditions) throws IOException {
String folderUrl = getFolderPath(folderName); String folderUrl = getFolderPath(folderName);
MessageList messages = new MessageList(); MessageList messages = new MessageList();
String searchRequest = "Select "+ attributes + String searchRequest = "Select " + attributes +
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderUrl + "\"')\n" + " FROM Scope('SHALLOW TRAVERSAL OF \"" + folderUrl + "\"')\n" +
" WHERE \"DAV:ishidden\" = False AND \"DAV:isfolder\" = False\n"; " WHERE \"DAV:ishidden\" = False AND \"DAV:isfolder\" = False\n";
if (conditions != null) { if (conditions != null) {
@ -1313,6 +1313,7 @@ public class ExchangeSession {
// Convert event class from and to iCal // Convert event class from and to iCal
// See https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-privateevents.txt // See https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-privateevents.txt
boolean isAppleiCal = false; boolean isAppleiCal = false;
boolean hasOrganizer = false;
String eventClass = null; String eventClass = null;
List<AllDayState> allDayStates = new ArrayList<AllDayState>(); List<AllDayState> allDayStates = new ArrayList<AllDayState>();
@ -1340,6 +1341,8 @@ public class ExchangeSession {
eventClass = value; eventClass = value;
} else if (!isAppleiCal && "CLASS".equals(key)) { } else if (!isAppleiCal && "CLASS".equals(key)) {
eventClass = value; eventClass = value;
} else if (key.startsWith("ORGANIZER")) {
hasOrganizer = true;
} }
} }
} }
@ -1402,6 +1405,10 @@ public class ExchangeSession {
result.writeLine("X-CALENDARSERVER-ACCESS:" + eventClass); result.writeLine("X-CALENDARSERVER-ACCESS:" + eventClass);
} }
} }
} else if ("END:VEVENT".equals(line)) {
if (!hasOrganizer) {
result.writeLine("ORGANIZER:MAILTO:" + email);
}
} }
result.writeLine(line); result.writeLine(line);
} }
@ -1485,7 +1492,8 @@ public class ExchangeSession {
/** /**
* Parse ics event for attendees and organizer. * Parse ics event for attendees and organizer.
* For notifications, only include attendees with RSVP=TRUE or PARTSTAT=NEEDS-ACTION * For notifications, only include attendees with RSVP=TRUE or PARTSTAT=NEEDS-ACTION
* @param icsBody ics event *
* @param icsBody ics event
* @param isNotification get only notified attendees * @param isNotification get only notified attendees
* @return participants * @return participants
* @throws IOException on error * @throws IOException on error
@ -1517,8 +1525,8 @@ public class ExchangeSession {
// also exclude no action attendees // also exclude no action attendees
} else if (!email.equalsIgnoreCase(value) && value.indexOf('@') >= 0 } else if (!email.equalsIgnoreCase(value) && value.indexOf('@') >= 0
&& (!isNotification && (!isNotification
|| line.indexOf("RSVP=TRUE") >= 0) || line.indexOf("RSVP=TRUE") >= 0
|| line.indexOf("PARTSTAT=NEEDS-ACTION") >=0) { || line.indexOf("PARTSTAT=NEEDS-ACTION") >= 0)) {
attendees.add(value); attendees.add(value);
} }
} }
@ -2065,7 +2073,7 @@ public class ExchangeSession {
} }
if (freeBusy != null && freeBusy.knownAttendee) { if (freeBusy != null && freeBusy.knownAttendee) {
return freeBusy; return freeBusy;
} else { } else {
return null; return null;
} }