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

Caldav: outbox handling, notify all attendees if current user is organizer,

else notify only organizer

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@364 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-16 23:42:07 +00:00
parent 5245ece50a
commit a21cfb1b8a

View File

@ -1397,7 +1397,8 @@ public class ExchangeSession {
}
protected String getRecipients(String icsBody) throws IOException {
StringBuilder recipients = new StringBuilder();
HashSet<String> recipients = new HashSet<String>();
String organizer = null;
BufferedReader reader = null;
try {
reader = new ICSBufferedReader(new StringReader(icsBody));
@ -1411,17 +1412,16 @@ public class ExchangeSession {
if (semiColon >= 0) {
key = key.substring(0, semiColon);
}
if ("ATTENDEE".equals(key)) {
if ("ORGANIZER".equals(key) || "ATTENDEE".equals(key)) {
int colonIndex = value.indexOf(':');
if (colonIndex >= 0) {
value = value.substring(colonIndex + 1);
}
// exclude current user from recipients
if (!email.equalsIgnoreCase(value)) {
if (recipients.length() > 0) {
recipients.append(", ");
}
recipients.append(value);
if ("ORGANIZER".equals(key)) {
organizer = value;
// exclude current user from recipients
} else if (!email.equalsIgnoreCase(value)) {
recipients.add(value);
}
}
}
@ -1431,7 +1431,21 @@ public class ExchangeSession {
reader.close();
}
}
return recipients.toString();
StringBuilder result = new StringBuilder();
if (email.equalsIgnoreCase(organizer)) {
// current user is organizer => notify all
for (String recipient : recipients) {
if (result.length() > 0) {
result.append(", ");
}
result.append(recipient);
}
} else {
// notify only organizer
result.append(organizer);
}
return result.toString();
}
protected EventResult internalCreateOrUpdateEvent(String messageUrl, String contentClass, String icsBody, String etag, String noneMatch) throws IOException {