1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

Caldav: improve MIME message headers in createOrUpdateEvent

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@858 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-11-25 21:58:25 +00:00
parent 849ba11a5e
commit 98bd73aa16

View File

@ -72,20 +72,25 @@ public class ExchangeSession {
public static final SimpleTimeZone GMT_TIMEZONE = new SimpleTimeZone(0, "GMT");
protected static final Set<String> USER_NAME_FIELDS = new HashSet<String>();
static {
USER_NAME_FIELDS.add("username");
USER_NAME_FIELDS.add("txtUserName");
USER_NAME_FIELDS.add("userid");
USER_NAME_FIELDS.add("SafeWordUser");
}
protected static final Set<String> PASSWORD_FIELDS = new HashSet<String>();
static {
PASSWORD_FIELDS.add("password");
PASSWORD_FIELDS.add("txtUserPass");
PASSWORD_FIELDS.add("pw");
PASSWORD_FIELDS.add("basicPassword");
}
protected static final Set<String> TOKEN_FIELDS = new HashSet<String>();
static {
TOKEN_FIELDS.add("SafeWordPassword");
}
@ -2361,14 +2366,16 @@ public class ExchangeSession {
}
}
Participants participants = new Participants();
StringBuilder result = new StringBuilder();
for (String recipient : attendees) {
if (result.length() > 0) {
result.append(", ");
if (!attendees.isEmpty()) {
StringBuilder result = new StringBuilder();
for (String recipient : attendees) {
if (result.length() > 0) {
result.append(", ");
}
result.append(recipient);
}
result.append(recipient);
participants.attendees = result.toString();
}
participants.attendees = result.toString();
participants.organizer = organizer;
return participants;
}
@ -2394,6 +2401,11 @@ public class ExchangeSession {
"Content-class: ");
writer.write(contentClass);
writer.write("\r\n");
// append date
SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z", Locale.ENGLISH);
writer.write("Date: ");
writer.write(formatter.format(new Date()));
writer.write("\r\n");
if ("urn:content-classes:calendarmessage".equals(contentClass)) {
// need to parse attendees and organizer to build recipients
Participants participants = getParticipants(icsBody, true);
@ -2423,16 +2435,21 @@ public class ExchangeSession {
// need to parse attendees and organizer to build recipients
Participants participants = getParticipants(icsBody, false);
// storing appointment, full recipients header
writer.write("To: ");
if (participants.attendees != null) {
writer.write("To: ");
writer.write(participants.attendees);
writer.write("\r\n");
} else {
writer.write(email);
}
writer.write("\r\n");
writer.write("From: ");
if (participants.organizer != null) {
writer.write("From: ");
writer.write(participants.organizer);
writer.write("\r\n");
} else {
writer.write(email);
}
writer.write("\r\n");
// if not organizer, set REPLYTIME to force Outlook in attendee mode
if (participants.organizer != null && !email.equalsIgnoreCase(participants.organizer)) {
if (icsBody.indexOf("METHOD:") < 0) {