Re: [gmime-devel] What's the preferred way to retrieve message body?



Title: RE: [gmime-devel] What's the preferred way to retrieve message body?

>> Anyway, a 99% solution would be a good start. Jeffrey, would you be interested
>> in this? If you would add a basic g_mime_message_guess_body, in a couple of
>> iterations we could improve the heuristics to be at least as good as just
>> about any mail reader -- and they usually don't have much trouble guessing the
>> right body part.
  
> I'll consider doing it (the question gets asked a lot). I think I like
> your idea of naming it guess_body() which makes it a bit more clear that
> it really is only a guess. I think I'd also make it return the GMimePart
> (or a GMimeObject) that represented the body rather than returning a
> string buffer. If it returned a GMimeObject, I could just make it return
> the multipart/alternative as a whole and let the caller sort out which
> part it wants to use from that. Of course, then there'd have to be a way
> to deal with encrypted parts... and multipart/related parts.

If you can add it, I still think we should call it g_mime_message_get_body().
With any given message, with a set of rules, we can definitely say what the
body is. We just need to publish the rules (in FAQ), so if people don't agree
with them, they can parse the body themselves as they can do now.

As for the example of some mailer's 'simple way of doing "embedded" multimedia',
you can return the whole "multipart/related" (my guess) as body. Some other
mailer might consider only the first chunk as body, but once they know the
rules, they can take different approach.

I like the idea of returning GMimeObject. Since the audience of GMIME is
developers, the structural correctness should trump the convenience. For
example, the standard didn't dictate that the "alternatives" can't be both
HTML, so leaving it to the developer is a good idea. The old get_body()
API returns "char *", which also doesn't sit well with body in 8-bit or
binary encoding.

The problem of "guess" is that once you _guess_ the body, you would have to
guess other parts, such as attachments, and people will use it anyway. Again,
once the rules are clear, it will be easy for everyone.

My two cents.

- Junping




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]