Bug 1158036 - Support sendMailTo for URN type attendees;r=philipp
This commit is contained in:
Родитель
f039d125f1
Коммит
f82b211a11
|
@ -411,30 +411,8 @@ calMailButtonDNDObserver.prototype = {
|
|||
*/
|
||||
onDropItems: function(aItems) {
|
||||
if (aItems && aItems.length > 0) {
|
||||
var item = aItems[0];
|
||||
|
||||
var recipients = "";
|
||||
var attendees = item.getAttendees({});
|
||||
for each (var attendee in attendees) {
|
||||
if (attendee.id && attendee.id.length) {
|
||||
var email = attendee.id;
|
||||
var re = new RegExp("^mailto:(.*)", "i");
|
||||
if (email && email.length) {
|
||||
if (re.test(email)) {
|
||||
email = RegExp.$1;
|
||||
} else {
|
||||
email = email;
|
||||
}
|
||||
}
|
||||
// Prevent trailing commas.
|
||||
if (recipients.length > 0) {
|
||||
recipients += ",";
|
||||
}
|
||||
// Add this recipient id to the list.
|
||||
recipients += email;
|
||||
}
|
||||
}
|
||||
|
||||
let item = aItems[0];
|
||||
let recipients = cal.getRecipientList(item.getAttendees({}));
|
||||
let identity = item.calendar.getProperty("imip.identity");
|
||||
sendMailTo(recipients, item.title, item.getProperty("DESCRIPTION"), identity);
|
||||
}
|
||||
|
|
|
@ -213,28 +213,11 @@ function taskViewUpdate(aFilter) {
|
|||
function sendMailToOrganizer() {
|
||||
var item = document.getElementById("calendar-task-tree").currentTask;
|
||||
if (item != null) {
|
||||
var organizer = item.organizer;
|
||||
if (organizer) {
|
||||
if (organizer.id && organizer.id.length) {
|
||||
var email = organizer.id;
|
||||
var re = new RegExp("^mailto:(.*)", "i");
|
||||
if (email && email.length) {
|
||||
if (re.test(email)) {
|
||||
email = RegExp.$1;
|
||||
} else {
|
||||
email = email;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the subject
|
||||
var emailSubject = calGetString("calendar-event-dialog",
|
||||
"emailSubjectReply",
|
||||
[item.title]);
|
||||
|
||||
let identity = item.calendar.getProperty("imip.identity");
|
||||
sendMailTo(email, emailSubject, null, identity);
|
||||
}
|
||||
}
|
||||
let organizer = item.organizer;
|
||||
let email = cal.getAttendeeEmail(organizer, true);
|
||||
let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
|
||||
let identity = item.calendar.getProperty("imip.identity");
|
||||
sendMailTo(email, emailSubject, null, identity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3665,33 +3665,9 @@ function sendMailToUndecidedAttendees(aAttendees) {
|
|||
* @param aAttendees The attendees to send mail to.
|
||||
*/
|
||||
function sendMailToAttendees(aAttendees) {
|
||||
var toList = "";
|
||||
var item = saveItem();
|
||||
|
||||
for each (var attendee in aAttendees) {
|
||||
if (attendee.id && attendee.id.length) {
|
||||
var email = attendee.id;
|
||||
var re = new RegExp("^mailto:(.*)", "i");
|
||||
if (email && email.length) {
|
||||
if (re.test(email)) {
|
||||
email = RegExp.$1;
|
||||
} else {
|
||||
email = email;
|
||||
}
|
||||
}
|
||||
// Prevent trailing commas.
|
||||
if (toList.length > 0) {
|
||||
toList += ",";
|
||||
}
|
||||
// Add this recipient id to the list.
|
||||
toList += email;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the subject
|
||||
var emailSubject = calGetString("calendar-event-dialog",
|
||||
"emailSubjectReply",
|
||||
[item.title]);
|
||||
let toList = cal.getRecipientList(aAttendees);
|
||||
let item = saveItem();
|
||||
let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
|
||||
let identity = window.calendarItem.calendar.getProperty("imip.identity");
|
||||
sendMailTo(toList, emailSubject, null, identity);
|
||||
}
|
||||
|
|
|
@ -359,23 +359,13 @@ function browseDocument() {
|
|||
* organizer an email.
|
||||
*/
|
||||
function sendMailToOrganizer() {
|
||||
var args = window.arguments[0];
|
||||
var item = args.calendarEvent;
|
||||
|
||||
var organizer = item.organizer;
|
||||
if (organizer) {
|
||||
if (organizer.id && organizer.id.length) {
|
||||
var email = organizer.id.replace(/^mailto:/i, "");
|
||||
|
||||
// Set up the subject
|
||||
var emailSubject = calGetString("calendar-event-dialog",
|
||||
"emailSubjectReply",
|
||||
[item.title]);
|
||||
|
||||
let identity = item.calendar.getProperty("imip.identity");
|
||||
sendMailTo(email, emailSubject, null, identity);
|
||||
}
|
||||
}
|
||||
let args = window.arguments[0];
|
||||
let item = args.calendarEvent;
|
||||
let organizer = item.organizer;
|
||||
let email = cal.getAttendeeEmail(organizer, true);
|
||||
let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
|
||||
let identity = item.calendar.getProperty("imip.identity");
|
||||
sendMailTo(email, emailSubject, null, identity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -330,6 +330,25 @@ let cal = {
|
|||
return email;
|
||||
},
|
||||
|
||||
/**
|
||||
* Provides a string to use in email "to" header for given attendees
|
||||
*
|
||||
* @param {array} aAttendees - array of calIAttendee's to check
|
||||
* @return {string} Valid string to use in a 'to' header of an email
|
||||
*/
|
||||
getRecipientList: function (aAttendees) {
|
||||
let cbEmail = function (aVal, aInd, aArr) {
|
||||
let email = cal.getAttendeeEmail(aVal, true);
|
||||
if (!email.length) {
|
||||
cal.LOG("Dropping invalid recipient for email transport: " + aVal.toString());
|
||||
}
|
||||
return email;
|
||||
}
|
||||
return aToList.map(cbEmail)
|
||||
.filter(function (aVal, aInd, aArr) {return (aVal.length)})
|
||||
.join(', ');
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the default transparency to apply for an event depending on whether its an all-day event
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче