On 1/15/2013 3:44 AM, Jonathan Protzenko wrote:
> - What is the transition plan? One thing we could do is, whenever gloda
> indexes a message, have it decoded both by your library and the original
> libmime, and see whether the two disagree. That would be a good test for
> your library, and it would only affect the jsmimeemitter, not the
> regular message display component.
There are approximately 5 distinct entry points to libmime:
- nsIMimeHeaders (an XPCOM wrapper around the MimeHeaders, er, struct)
- nsIMimeConverter (effectively an exposed RFC 2047 encoding/decoding
library, with other noscript methods I have a patch to replace with a
more natural C++ API)
- nsIMsgHeaderParser (effectively a parser for To: and related headers)
- the stream converter
- Gloda
The first three interfaces I plan to unconditionally replace with my
implementation, and I already have WIPs for two of them. It turns out
that we actually have pretty decent coverage of these interfaces in
tests, so passing our test suite on these interfaces makes me relatively
confident in my implementation. For gloda and the stream converter, my
plan is to provide a transition by providing alternate implementations
that can be controlled with a preference. My original goal was to have a
prototype in the tree by the time we ship the TB 24 branch, but it looks
like I will slip that schedule.
There are also other places where people should be using libmime but
aren't because, well, you can't, and as a result code up their own
ad-hoc parsers; my plan is to switch these as what I have works. The
cases I can think of off the top of my head are the fakeservers,
nsMsgBodySearch, and nsMsgDBFolder::GetMessageTextFromStream.
> - Have you talked this over with Patrick Brunschwig (Enigmail author)?
> There are some people out there who definitely need to be able to plug
> in your infrastructure to provide support for extra mime parts.
No, not yet--I have not yet prototyped this stage, but the needs of
Enigmail are one of the factors that drive my design decisions.
> - Does your new parser create a MimeMessage as in
> mailnews/db/gloda/modules/mimemsg.js?
No. Gloda's model of a mime message is similar to my own, but it is not
quite sufficient for my needs, and I need to investigate how gloda deals
with some of libmime's magic better [1], particularly for the case of
uuencode and yenc message bodies. Generating mimemsg.js from my own mime
parser takes fewer than 100 lines of code at present.
> - If so, do you have plans for creating a MimeMessage → HTML renderer?
My plans are to cleanly divide the MIME parser into three separate stages:
1. MIME structure parser
2. Mime structure -> body and attachments view
3. Actually displaying a message in the UI
(although keeping 2 and 3 separate is proving harder than anticipated)
[1] One key example here is that gloda lets libmime convert some parts
to HTML but not others--text/enriched being the dominant example
here--which is actually what prompted my featurectomy proposal in the
first place.