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



>>>>> "Jeffrey" == Jeffrey Stedfast <fejj novell com> writes:

    Jeffrey> Junping Zhang wrote:
    >> 
    >> Thanks a lot for the explanation!
    >> 
    >> > The problem with g_mime_message_get_body() is that it made a lot of
    >> > assumptions about the structure of the message (meaning it was pretty
    >> > naive). Because of this, it wouldn't properly work on all messages.
    >> 
    >> As Dirk mentioned in the earlier post, the body is obvious in 99% of
    >> cases.  I would say that you can define the body part with a given
    >> email. I like the new API, but when you have time, if you can list the
    >> cases where body can't be clearly defined, it will be good
    >> information. Off hand, I can iterate the following (that's probably
    >> outside of that 99% :)):
    >> 

<snip>

    Jeffrey> Part of the problem is that some mailers might split the body into
    Jeffrey> multiple text parts (for various reasons, such as trying to be fancy
    Jeffrey> about embedding images between paragraphs of text or whatever else w/o
    Jeffrey> resorting to using text/html).

Getting the body of a message is a rather common operation though, so I think
it would make sense to put the various heuristics in GMime. I think most GMime
users would need something like it, and it would help them a lot, even if it's
'only' a 99% solution.

Maybe express the difficulties in the name (e.g.,
'g_mime_message_guess_body').

One additional parameter would be the preferred mime-type -- sometimes, html
is preferred, and sometimes plain text. If we cannot find the preferred type,
we might need to opt for the other. And then there are messages that have
something totally different as body... e.g,., a PDF.

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.

Best wishes,
Dirk.

-- 
Dirk-Jan C. Binnema                  Helsinki, Finland
e:djcb djcbsoftware nl           w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C


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