rem:  alert( "We don't yet support email messages" ); 
add: var Listener = { onStreamComplete: function(loader, ctxt, status, resultLength, result) {  if( result.indexOf( "BEGIN:VCALENDAR" ) == -1 ) return false;   var BeginEventText = "BEGIN:VEVENT"; var firstMatchLocation = result.indexOf( BeginEventText ); if( firstMatchLocation == -1 ) return false; else { if( result.indexOf( BeginEventText, firstMatchLocation + BeginEventText.length + 1 ) == -1 ) { var iCalEventComponent = Components.classes["@mozilla.org/icalevent;1"].createInstance(); var calendarEvent = iCalEventComponent.QueryInterface(Components.interfaces.oeIICalEvent); calendarEvent.parseIcalString( result );  /* EDITING AN EXISTING EVENT IS NOT WORKING   var Result = gCalendarWindow.eventSource.gICalLib.fetchEvent( calendarEvent.id );  if( Result ) { editEvent( calendarEvent ); } else {   */ editNewEvent( calendarEvent, null );  } else {  var profileFile = gCalendarWindow.calendarManager.getProfileDirectory();  profileFile.append("Calendar"); profileFile.append("Email"+gCalendarWindow.calendarManager.rootContainer.getSubNodes().length+".ics");  FilePath = profileFile.path; saveDataToFile(FilePath, result, null);  gCalendarWindow.calendarManager.launchAddCalendarDialog( CalendarName, FilePath ); } } } }  var myInstance = Components.classes["@mozilla.org/network/stream-loader;1"].createInstance(Components.interfaces.nsIStreamLoader);  myInstance.init( Channel, Listener, null ); 
context: calendarManager.prototype.checkCalendarURL = function calMan_checkCalendarURL( CalendarURL ){   var calendarSubscribed = this.isURLAlreadySubscribed( CalendarURL );   if( calendarSubscribed === false )   {      if( CalendarURL.indexOf( "imap://" ) != -1 )      {         //this is an imap email message, download it to a file and show it.         alert( "We don't yet support email messages" );      }      else      {         //not subscribed, prompt the user to do so.         var arrayForNames = CalendarURL.split( "/" );         var CalendarNameWithExtension = arrayForNames[ arrayForNames.length - 1 ];         var CalendarName = CalendarNameWithExtension.replace( ".ics", "" );         this.launchAddCalendarDialog( CalendarName, CalendarURL );      }   }   else   {      //calendarSubscribed is the subscribed calendar object.      if( calendarSubscribed.active == false )      {         calendarSubscribed.active = true;         gCalendarWindow.calendarManager.addCalendar( calendarSubscribed );               document.getElementById( "calendar-list-item-"+calendarSubscribed.serverNumber ).setAttribute( "checked", "true" );         refreshEventTree( false );         refreshToDoTree( false );            gCalendarWindow.currentView.refreshEvents();      }   }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/eccfe24949238ab11afd71e280a2c50fe7ee3ea0/calendarManager.js/buggy/calendar/resources/content/calendarManager.js