Bug 445728 ��� Delete an single event of a recurring event with attendees -> 'Notify Attendees' dialog pops up two times; r=philipp

This commit is contained in:
daniel.boelzle%sun.com 2008-07-21 07:41:35 +00:00
Родитель f45524172e
Коммит 57834de6d2
4 изменённых файлов: 21 добавлений и 23 удалений

Просмотреть файл

@ -510,7 +510,7 @@ function checkAndSendItipMessage(aItem, aOpType, aOriginalItem) {
var itipItem = Components.classes["@mozilla.org/calendar/itip-item;1"]
.createInstance(Components.interfaces.calIItipItem);
itipItem.init(aItem.icalString);
itipItem.init(calGetSerializedItem(aItem));
itipItem.targetCalendar = aItem.calendar;
itipItem.autoResponse = Components.interfaces.calIItipItem.USER;
itipItem.responseMethod = "REPLY";
@ -530,7 +530,7 @@ function checkAndSendItipMessage(aItem, aOpType, aOriginalItem) {
}
for each (var att in itemAtt) {
if (att.id in attMap) {
if (att.id.toLowerCase() in attMap) {
// Attendee was in original item.
delete attMap[att.id.toLowerCase()];
}
@ -586,6 +586,9 @@ function checkAndSendItipMessage(aItem, aOpType, aOriginalItem) {
}
function calSendItipMessage(aItem, aMethod, aRecipientsList) {
if (aRecipientsList.length == 0) {
return;
}
if ((aItem.calendar instanceof Components.interfaces.calISchedulingSupport) &&
aItem.calendar.canNotify(aMethod, aItem)) {
return; // provider will handle that
@ -600,16 +603,15 @@ function calSendItipMessage(aItem, aMethod, aRecipientsList) {
var item = aItem.clone();
// We fake Sequence ID support.
item.setProperty("METHOD", aMethod);
item.setProperty("SEQUENCE", item.generation);
// Initialize and set our properties on the item
itipItem.init(item.icalString);
itipItem.init(calGetSerializedItem(item));
itipItem.responseMethod = aMethod;
itipItem.targetCalendar = item.calendar;
itipItem.autoResponse = Components.interfaces.calIItipItem.USER;
// XXX I don't know whether the below are used at all, since we don't use the itip processor
itipItem.isSend = true;
itipItem.receivedMethod = aMethod;
// Get ourselves some default text - when we handle organizer properly
// We'll need a way to configure the Common Name attribute and we should
@ -641,3 +643,10 @@ function calSendItipMessage(aItem, aMethod, aRecipientsList) {
transport.sendItems(aRecipientsList.length, aRecipientsList, subject, body, itipItem);
}
function calGetSerializedItem(aItem) {
var serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]
.createInstance(Components.interfaces.calIIcsSerializer);
serializer.addItems([aItem], 1);
return serializer.serializeToString();
}

Просмотреть файл

@ -140,9 +140,6 @@ calEvent.prototype = {
get icalString() {
var calcomp = getIcsService().createIcalComponent("VCALENDAR");
calSetProdidVersion(calcomp);
if (this.hasProperty("METHOD")) {
calcomp.method = this.getProperty("METHOD");
}
calcomp.addSubcomponent(this.icalComponent);
return calcomp.serializeToICS();
},

Просмотреть файл

@ -558,7 +558,6 @@ calItemBase.prototype = {
"LAST-MODIFIED": true,
"SUMMARY": true,
"PRIORITY": true,
"METHOD": true,
"STATUS": true,
"CLASS": true,
"DTSTAMP": true,

Просмотреть файл

@ -317,20 +317,13 @@ calItipEmailTransport.prototype = {
}
var itemList = aItem.getItemList({});
var calText = "";
for (var i = 0; i < itemList.length; i++) {
var item = itemList[i].clone();
// This is a workaround until bug 353369 is fixed.
// Without it, we cannot roundtrip the METHOD property, so we must
// re-add it to the ICS data as we serialize it.
//
// Look at the implicit assumption in the code at:
// http://lxr.mozilla.org/seamonkey/source/calendar/base/src/calEvent.js#162
// and it's easy to see why.
item.setProperty("METHOD", aItem.responseMethod);
// xxx todo: should we consider to include exceptional/overridden items?
calText += item.icalString;
}
var serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]
.createInstance(Components.interfaces.calIIcsSerializer);
serializer.addItems(itemList, itemList.length);
var methodProp = getIcsService().createIcalProperty("METHOD");
methodProp.value = aItem.responseMethod;
serializer.addProperty(methodProp);
var calText = serializer.serializeToString();
var utf8CalText = encodeUTF8(calText);
// Home-grown mail composition; I'd love to use nsIMimeEmitter, but it's not clear to me whether