mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 19:52:21 -05: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:
parent
849ba11a5e
commit
98bd73aa16
@ -72,20 +72,25 @@ public class ExchangeSession {
|
|||||||
public static final SimpleTimeZone GMT_TIMEZONE = new SimpleTimeZone(0, "GMT");
|
public static final SimpleTimeZone GMT_TIMEZONE = new SimpleTimeZone(0, "GMT");
|
||||||
|
|
||||||
protected static final Set<String> USER_NAME_FIELDS = new HashSet<String>();
|
protected static final Set<String> USER_NAME_FIELDS = new HashSet<String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
USER_NAME_FIELDS.add("username");
|
USER_NAME_FIELDS.add("username");
|
||||||
USER_NAME_FIELDS.add("txtUserName");
|
USER_NAME_FIELDS.add("txtUserName");
|
||||||
USER_NAME_FIELDS.add("userid");
|
USER_NAME_FIELDS.add("userid");
|
||||||
USER_NAME_FIELDS.add("SafeWordUser");
|
USER_NAME_FIELDS.add("SafeWordUser");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final Set<String> PASSWORD_FIELDS = new HashSet<String>();
|
protected static final Set<String> PASSWORD_FIELDS = new HashSet<String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PASSWORD_FIELDS.add("password");
|
PASSWORD_FIELDS.add("password");
|
||||||
PASSWORD_FIELDS.add("txtUserPass");
|
PASSWORD_FIELDS.add("txtUserPass");
|
||||||
PASSWORD_FIELDS.add("pw");
|
PASSWORD_FIELDS.add("pw");
|
||||||
PASSWORD_FIELDS.add("basicPassword");
|
PASSWORD_FIELDS.add("basicPassword");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final Set<String> TOKEN_FIELDS = new HashSet<String>();
|
protected static final Set<String> TOKEN_FIELDS = new HashSet<String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
TOKEN_FIELDS.add("SafeWordPassword");
|
TOKEN_FIELDS.add("SafeWordPassword");
|
||||||
}
|
}
|
||||||
@ -2361,6 +2366,7 @@ public class ExchangeSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Participants participants = new Participants();
|
Participants participants = new Participants();
|
||||||
|
if (!attendees.isEmpty()) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (String recipient : attendees) {
|
for (String recipient : attendees) {
|
||||||
if (result.length() > 0) {
|
if (result.length() > 0) {
|
||||||
@ -2369,6 +2375,7 @@ public class ExchangeSession {
|
|||||||
result.append(recipient);
|
result.append(recipient);
|
||||||
}
|
}
|
||||||
participants.attendees = result.toString();
|
participants.attendees = result.toString();
|
||||||
|
}
|
||||||
participants.organizer = organizer;
|
participants.organizer = organizer;
|
||||||
return participants;
|
return participants;
|
||||||
}
|
}
|
||||||
@ -2394,6 +2401,11 @@ public class ExchangeSession {
|
|||||||
"Content-class: ");
|
"Content-class: ");
|
||||||
writer.write(contentClass);
|
writer.write(contentClass);
|
||||||
writer.write("\r\n");
|
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)) {
|
if ("urn:content-classes:calendarmessage".equals(contentClass)) {
|
||||||
// need to parse attendees and organizer to build recipients
|
// need to parse attendees and organizer to build recipients
|
||||||
Participants participants = getParticipants(icsBody, true);
|
Participants participants = getParticipants(icsBody, true);
|
||||||
@ -2423,16 +2435,21 @@ public class ExchangeSession {
|
|||||||
// need to parse attendees and organizer to build recipients
|
// need to parse attendees and organizer to build recipients
|
||||||
Participants participants = getParticipants(icsBody, false);
|
Participants participants = getParticipants(icsBody, false);
|
||||||
// storing appointment, full recipients header
|
// storing appointment, full recipients header
|
||||||
if (participants.attendees != null) {
|
|
||||||
writer.write("To: ");
|
writer.write("To: ");
|
||||||
|
if (participants.attendees != null) {
|
||||||
writer.write(participants.attendees);
|
writer.write(participants.attendees);
|
||||||
writer.write("\r\n");
|
} else {
|
||||||
|
writer.write(email);
|
||||||
}
|
}
|
||||||
if (participants.organizer != null) {
|
|
||||||
|
writer.write("\r\n");
|
||||||
writer.write("From: ");
|
writer.write("From: ");
|
||||||
|
if (participants.organizer != null) {
|
||||||
writer.write(participants.organizer);
|
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 not organizer, set REPLYTIME to force Outlook in attendee mode
|
||||||
if (participants.organizer != null && !email.equalsIgnoreCase(participants.organizer)) {
|
if (participants.organizer != null && !email.equalsIgnoreCase(participants.organizer)) {
|
||||||
if (icsBody.indexOf("METHOD:") < 0) {
|
if (icsBody.indexOf("METHOD:") < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user