Re: [gmime-devel] stream parsing from network



Thanks for the hint, looks like that would not be too hard. Can you also help me with understanding how parser works, may be some little diagram when it calls stream_read and in which order calls are made? I assume parsing starts with g_mime_parser_construct_message?

On Thu, Jun 30, 2016 at 4:11 PM, Jeffrey Stedfast <fejj gnome org> wrote:
Hi Kane,

On 6/30/2016 1:56 PM, Kane Kim wrote:
I want to integrate with gmime from another language (go). I want to read message content from network and stream it to gmime. It's easy to accumulate whole message in a buffer and then use mem stream. What's best way to avoid doing that and send to gmime in chunks?

What you'll want to do is subclass GMimeStream and write a custom stream that reads the next block of data from the network when the parser calls g_mime_stream_read() (which means you'll want to override the read method).

You don't need to implement a write method unless you intend on writing to it, but you'll need to implement seek (just make it return -1 to say it doesn't support seeking).

Hope that helps,

Jeff



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