rem: icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"] .getService(Components.interfaces.calIICSService); var calComp = icssrv.createIcalComponent("VCALENDAR"); calComp.version = "2.0"; calComp.prodid = "-  for each (item in aItems) { calComp.addSubcomponent(item.icalComponent); var rec = item.recurrenceInfo; if (rec != null) { var exceptions = rec.getExceptionIds({}); for each ( var exid in exceptions ) { var ex = rec.getExceptionFor(exid, false); if (ex != null) { calComp.addSubcomponent(ex.icalComponent); } } } } var str = calComp.serializeToICS();    var convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .getService(Components.interfaces.nsIConverterOutputStream); convStream.init(aStream, 'UTF-8', 0, 0x0000);  convStream.writeString(str); convStream.close();  return; 
add: var serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]. createInstance(Components.interfaces.calIIcsSerializer); serializer.addItems(aItems, aItems.length); serializer.serializeToStream(aStream); 
context: function ics_exportToStream(aStream, aCount, aItems) {    icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]                       .getService(Components.interfaces.calIICSService);    var calComp = icssrv.createIcalComponent("VCALENDAR");    calComp.version = "2.0";    calComp.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";        for each (item in aItems) {        calComp.addSubcomponent(item.icalComponent);        var rec = item.recurrenceInfo;        if (rec != null) {            var exceptions = rec.getExceptionIds({});            for each ( var exid in exceptions ) {                var ex = rec.getExceptionFor(exid, false);                if (ex != null) {                    calComp.addSubcomponent(ex.icalComponent);                }            }        }        }    var str = calComp.serializeToICS();    // Convert the javascript string to an array of bytes, using the    // utf8 encoder    var convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]                               .getService(Components.interfaces.nsIConverterOutputStream);    convStream.init(aStream, 'UTF-8', 0, 0x0000);    convStream.writeString(str);    convStream.close();    return;};
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10234/caddb2ec4e4e6a2735f363bd9a1da951dce03167/calIcsImportExport.js/buggy/calendar/import-export/calIcsImportExport.js