- tny_stream_reset (stream);
- if (tny_stream_is_eos (stream)) {
- tny_stream_close (stream);
- stream = tny_mime_part_get_stream (priv->mime_part);
+ total = modest_count_stream_get_count(MODEST_COUNT_STREAM (stream));
+ if (total == 0) {
+ modest_count_stream_reset_count(MODEST_COUNT_STREAM (stream));
+ tny_mime_part_write_to_stream (priv->mime_part, stream);
+ total = modest_count_stream_get_count(MODEST_COUNT_STREAM (stream));