(mu_mime_get_part): Set stream_size function.
Showing
1 changed file
with
16 additions
and
2 deletions
... | @@ -406,7 +406,18 @@ _mime_parse_mpart_message (mu_mime_t mime) | ... | @@ -406,7 +406,18 @@ _mime_parse_mpart_message (mu_mime_t mime) |
406 | /*------ Mime message functions for READING a multipart message -----*/ | 406 | /*------ Mime message functions for READING a multipart message -----*/ |
407 | 407 | ||
408 | static int | 408 | static int |
409 | _mimepart_body_read (mu_stream_t stream, char *buf, size_t buflen, mu_off_t off, | 409 | _mimepart_body_stream_size (mu_stream_t stream, mu_off_t *psize) |
410 | { | ||
411 | size_t s; | ||
412 | mu_body_t body = mu_stream_get_owner (stream); | ||
413 | int rc = mu_body_size (body, &s); | ||
414 | *psize = s; | ||
415 | return rc; | ||
416 | } | ||
417 | |||
418 | static int | ||
419 | _mimepart_body_read (mu_stream_t stream, | ||
420 | char *buf, size_t buflen, mu_off_t off, | ||
410 | size_t * nbytes) | 421 | size_t * nbytes) |
411 | { | 422 | { |
412 | mu_body_t body = mu_stream_get_owner (stream); | 423 | mu_body_t body = mu_stream_get_owner (stream); |
... | @@ -874,7 +885,10 @@ mu_mime_get_part (mu_mime_t mime, size_t part, mu_message_t * msg) | ... | @@ -874,7 +885,10 @@ mu_mime_get_part (mu_mime_t mime, size_t part, mu_message_t * msg) |
874 | body)) == 0) | 885 | body)) == 0) |
875 | { | 886 | { |
876 | mu_stream_set_read (stream, _mimepart_body_read, body); | 887 | mu_stream_set_read (stream, _mimepart_body_read, body); |
877 | mu_stream_set_get_transport2 (stream, _mimepart_body_transport, | 888 | mu_stream_set_get_transport2 (stream, |
889 | _mimepart_body_transport, | ||
890 | body); | ||
891 | mu_stream_set_size (stream, _mimepart_body_stream_size, | ||
878 | body); | 892 | body); |
879 | mu_body_set_stream (body, stream, mime_part->msg); | 893 | mu_body_set_stream (body, stream, mime_part->msg); |
880 | mu_message_set_body (mime_part->msg, body, mime_part); | 894 | mu_message_set_body (mime_part->msg, body, mime_part); | ... | ... |
-
Please register or sign in to post a comment