[gmime-devel] Mapping MIME parts to byte offsets



Hi everyone,

Long time no see ;)

I've been trying to use GMime to get various byte offsets into a mail - for example, where the content body of a attachment starts, how big it is, that kind of thing.

To begin with, I had a look at how DBMail does it which (unless I'm following the code incorrectly) is something along the lines of using g_mime_parser_construct_message(), iterating over the various parts and doing some string building / seeking to work out the numbers. As well as not being terribly efficient, it also strikes me that this might potentially get the wrong answers because of the amount of regenerating data it seems to be doing.

I think really what I want is basically what the GMime parser is holding internally, in the BoundaryStack, and maybe some pointers into a part looking at where headers start / end. I imagine this could probably be done with a bit of judicious _tell() here and there in the code, but thinking about the patch I'm not really sure how it would fit in.

I was thinking that perhaps GMimeObject could be extended to have this information, but I'm also not sure if that's necessary - perhaps it could be done programatically. g_mime_object_to_string for example appears to create the string from the data stream, but again seems to be re-creating data I think?

Thoughts? :)

Cheers!

Alex.


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