(mh_stream_to_message): Use MH draft streams.
Showing
1 changed file
with
20 additions
and
2 deletions
... | @@ -544,7 +544,7 @@ mh_file_copy (const char *from, const char *to) | ... | @@ -544,7 +544,7 @@ mh_file_copy (const char *from, const char *to) |
544 | return rc; | 544 | return rc; |
545 | } | 545 | } |
546 | 546 | ||
547 | static int | 547 | int |
548 | _mh_delim (char *str) | 548 | _mh_delim (char *str) |
549 | { | 549 | { |
550 | if (str[0] == '-') | 550 | if (str[0] == '-') |
... | @@ -679,12 +679,30 @@ mh_stream_to_message (stream_t instream) | ... | @@ -679,12 +679,30 @@ mh_stream_to_message (stream_t instream) |
679 | struct msg_envelope *mp; | 679 | struct msg_envelope *mp; |
680 | envelope_t env; | 680 | envelope_t env; |
681 | message_t msg; | 681 | message_t msg; |
682 | stream_t draftstream; | ||
683 | int rc; | ||
684 | |||
685 | if ((rc = mhdraft_stream_create (&draftstream, instream, 0))) | ||
686 | { | ||
687 | mh_error(_("cannot create draft message stream: %s"), | ||
688 | mu_strerror (rc)); | ||
689 | return NULL; | ||
690 | } | ||
691 | |||
692 | if ((rc = stream_open (draftstream))) | ||
693 | { | ||
694 | mh_error(_("cannot open draft message stream: %s"), | ||
695 | mu_strerror (rc)); | ||
696 | stream_destroy (&draftstream, stream_get_owner (draftstream)); | ||
697 | return NULL; | ||
698 | } | ||
682 | 699 | ||
683 | restore_envelope (instream, &mp); | 700 | restore_envelope (instream, &mp); |
701 | |||
684 | if (message_create (&msg, mp)) | 702 | if (message_create (&msg, mp)) |
685 | return NULL; | 703 | return NULL; |
686 | 704 | ||
687 | message_set_stream (msg, instream, mp); | 705 | message_set_stream (msg, draftstream, mp); |
688 | 706 | ||
689 | if (envelope_create (&env, msg)) | 707 | if (envelope_create (&env, msg)) |
690 | return NULL; | 708 | return NULL; | ... | ... |
-
Please register or sign in to post a comment