diff --git a/calendar/base/content/calendar-item-editing.js b/calendar/base/content/calendar-item-editing.js index 63c323bdc38..5c6ceddc67d 100644 --- a/calendar/base/content/calendar-item-editing.js +++ b/calendar/base/content/calendar-item-editing.js @@ -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(); +} + diff --git a/calendar/base/src/calEvent.js b/calendar/base/src/calEvent.js index 894198218b3..a0f1630d48c 100644 --- a/calendar/base/src/calEvent.js +++ b/calendar/base/src/calEvent.js @@ -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(); }, diff --git a/calendar/base/src/calItemBase.js b/calendar/base/src/calItemBase.js index 83fc4cf2a25..a24f6b0110f 100644 --- a/calendar/base/src/calItemBase.js +++ b/calendar/base/src/calItemBase.js @@ -558,7 +558,6 @@ calItemBase.prototype = { "LAST-MODIFIED": true, "SUMMARY": true, "PRIORITY": true, - "METHOD": true, "STATUS": true, "CLASS": true, "DTSTAMP": true, diff --git a/calendar/itip/calItipEmailTransport.js b/calendar/itip/calItipEmailTransport.js index 4b97db683ad..5b4b1dfa39d 100644 --- a/calendar/itip/calItipEmailTransport.js +++ b/calendar/itip/calItipEmailTransport.js @@ -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