Last Comment Bug 351997 - Lightning throws exception when viewing event invitation sent from iCal.app
: Lightning throws exception when viewing event invitation sent from iCal.app
Status: RESOLVED FIXED
: fixed1.8.1
Product: MailNews Core
Classification: Components
Component: MIME (show other bugs)
: Trunk
: PowerPC Mac OS X
: -- major (vote)
: ---
Assigned To: David :Bienvenu
:
Mentors:
: 366760 390435 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-09 19:26 PDT by Matthew (lilmatt) Willis
Modified: 2008-07-31 04:30 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
example email invitation (3.20 KB, text/plain)
2006-09-09 19:28 PDT, Matthew (lilmatt) Willis
no flags Details
proposed fix (956 bytes, patch)
2006-09-14 10:21 PDT, David :Bienvenu
no flags Details | Diff | Splinter Review

Description Matthew (lilmatt) Willis 2006-09-09 19:26:57 PDT
You can invite people to events in iCal.app.  When iCal.app sends the invitation, it encodes the included ICS data as quoted-printable.  When Thunderbird hands us the data from the message, the data is still encoded (containing =0D and =0A chars instead of \r and \n) which causes our ics parse to barf.

Part of this is deciding whether or not the data should be decoded by Thunderbird before it hands it off to us.  I would tend to argue yes, but I could be convinced otherwise.



Error from Thunderbird's error console:
Error: [Exception... "Component returned failure code: 0x804a0100 [calIICSService.parseICS]"  nsresult: "0x804a0100 (<unknown>)"  location: "JS frame :: file:///Users/mwillis/Library/Thunderbird/Profiles/f3zmkc5o.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/js/calItemBase.js :: icalFromString :: line 761"  data: no]
Source File: file:///Users/mwillis/Library/Thunderbird/Profiles/f3zmkc5o.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/js/calItemBase.js
Line: 761


Example ICS that is passed to Lightning:

Content-Transfer-Encoding: quoted-printable
Content-Type: text/calendar;
	x-unix-mode=0644;
	name=iCal-20060908-150855.ics
Content-Disposition: attachment;
	filename=iCal-20060908-150855.ics

BEGIN:VCALENDAR=0D=0APRODID:-//Apple=20Computer\,=20Inc//iCal=202.0//EN=0D=
=0AMETHOD:REQUEST=0D=0ACALSCALE:GREGORIAN=0D=0AVERSION:2.0=0D=0A=
BEGIN:VTIMEZONE=0D=0ATZID:America/New_York=0D=0A=
LAST-MODIFIED:20060908T190855Z=0D=0ABEGIN:DAYLIGHT=0D=0A=
DTSTART:20060402T070000=0D=0ATZOFFSETTO:-0400=0D=0ATZOFFSETFROM:+0000=0D=0A=
TZNAME:EDT=0D=0AEND:DAYLIGHT=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:20061029T020000=0D=0ATZOFFSETTO:-0500=0D=0ATZOFFSETFROM:-0400=0D=0A=
TZNAME:EST=0D=0AEND:STANDARD=0D=0AEND:VTIMEZONE=0D=0ABEGIN:VEVENT=0D=0A=
DURATION:PT1H=0D=0AATTENDEE;CN=3D"Matthew=20=
Willis";PARTSTAT=3DACCEPTED:mailto:mattwillis@mac.com=0D=0A=20=0D=0A=
ATTENDEE:mailto:mattstest@ecornell.com=0D=0ADTSTAMP:20060908T190852Z=0D=0A=
UID:B756B5BC-B459-4705-8602-3B768A42A630=0D=0ASEQUENCE:7=0D=0A=
DTSTART;TZID=3DAmerica/New_York:20060908T160000=0D=0ASUMMARY:Testy=20=
Vent=0D=0AORGANIZER;CN=3D"Matthew=20Willis":mailto:mattwillis@mac.com=0D=0A=
END:VEVENT=0D=0AEND:VCALENDAR=0D=0A=


Interesting lxr links for possible help:

Quoted Printable decoder:
http://lxr.mozilla.org/mozilla/source/mailnews/mime/src/mimeenc.cpp#827

nsSimpleMimeConverterStub:
http://lxr.mozilla.org/mozilla/source/mailnews/mime/src/nsSimpleMimeConverterStub.cpp
Comment 1 Matthew (lilmatt) Willis 2006-09-09 19:28:08 PDT
Created attachment 237560 [details]
example email invitation
Comment 2 David :Bienvenu 2006-09-11 08:46:12 PDT
The simple mime converter needs to do the decoding, I think. For some interesting details, see 

http://lxr.mozilla.org/seamonkey/source/mailnews/mime/src/mimeleaf.h#44

I'll try to figure out how it would do that...
Comment 3 David :Bienvenu 2006-09-11 09:26:21 PDT
looking at the code, I'm not sure that this shouldn't be happening automatically already from functionality in the MimeLeaf class...but Mime's hand-rolled object-orientedness doesn't make it easy to know for sure.
Comment 4 David :Bienvenu 2006-09-14 10:21:51 PDT
Created attachment 238448 [details] [diff] [review]
proposed fix

we need to initialize the base class object in order for the decoders to work.
Comment 5 David :Bienvenu 2006-09-14 12:23:56 PDT
fixed on trunk and 1.8.1 branch
Comment 6 David :Bienvenu 2006-09-14 12:26:05 PDT
oving to core | mime component, reassigning to myself, and marking fixed.
Comment 7 David :Bienvenu 2007-03-22 08:26:14 PDT
*** Bug 366760 has been marked as a duplicate of this bug. ***
Comment 8 Stefan Sitter 2007-09-10 06:58:42 PDT
*** Bug 390435 has been marked as a duplicate of this bug. ***
Comment 9 Carl Menezes 2007-11-28 13:51:45 PST
Lightning 0.7 release notes say : "When installed in Thunderbird 1.5, Lightning can not read iMIP invitations sent from users of Apple iCal.app. However, this works correctly in Thunderbird 2.0. (bug 351997)" 

However, I am on Thunderbird version 2.0.0.9 (20071031) with Lightning 0.7 (build 2007102304) on a PC (Win XP) and am unable to receive invitations correctly from a mail sent from iCal:

The iCal invite is an emial with an ICS attachment. 
Here are the relevant message headers :
Content-Type: multipart/alternative; boundary=Apple-Mail-107-924246435
Mime-Version: 1.0 (Apple Message framework v915)
X-Mail-Calendar-Part: Yes
X-Mailer: Apple Mail (2.915)

I don't know what IMIP is, but if it helps, when I open the attachment in Sunbird, the event is created. Its just that Lightning does not see it as an invitation and does not allow me to respond to the invitation. Hope this helps.
Comment 10 Carl Menezes 2007-11-28 13:55:02 PST
There are also two other headers to the message : 

X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000 

Not sure what they mean, but am reporting them in case they help. Will be glad to carry out any tests if necessary. 
Comment 11 Carl Menezes 2007-11-28 14:01:50 PST
Here's the ICS file with names and emails changed..

BEGIN:VCALENDAR
PRODID:-//Apple Inc.//iCal 3.0//EN
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:REQUEST
BEGIN:VTIMEZONE
TZID:Pacific/Auckland
BEGIN:STANDARD
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
DTSTART:19900318T030000
RRULE:FREQ=YEARLY;UNTIL=20070317T140000Z;BYMONTH=3;BYDAY=3SU
TZNAME:NZST
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1200
TZOFFSETTO:+1300
DTSTART:20070930T020000
RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU
TZNAME:NZDT
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
DTSTART:20080406T030000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
TZNAME:NZST
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SEQUENCE:2
DTSTART;TZID=Pacific/Auckland:20071130T153000
DTSTAMP:20071127T013427Z
SUMMARY:1.8 showstopper meeting
ATTENDEE;CN="attendee1";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=
 REQ-PARTICIPANT;RSVP=TRUE:mailto:person1@test.com
ATTENDEE;CN="attendee2";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;
 ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:person2@test.com
ATTENDEE;CN="inviter";PARTSTAT=ACCEPTED:mailto:inviter@test.com
DTEND;TZID=Pacific/Auckland:20071130T160000
LOCATION:QA\n
TRANSP:OPAQUE
UID:590863D5-56DF-433B-B2FB-3FDD7FCD37F3
ORGANIZER;CN="Inviter Name":mailto:inviter@test.com
CREATED:20071118T234542Z
END:VEVENT
END:VCALENDAR

Note You need to log in before you can comment on or make changes to this bug.