diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-02-21 13:01:55 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-02-21 13:01:55 +0000 |
commit | f0264023cebb4196a6df797bdc81eba09e4f9c30 (patch) | |
tree | 32bb51ffaf0b53ca8dd340b24d0d3c6768eda443 | |
parent | ef0381448c8a196361f151322fe8b16cc4926860 (diff) | |
download | mailutils-f0264023cebb4196a6df797bdc81eba09e4f9c30.tar.gz mailutils-f0264023cebb4196a6df797bdc81eba09e4f9c30.tar.bz2 |
(mh_stream_to_message): Use MH draft streams.
-rw-r--r-- | mh/mh_init.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/mh/mh_init.c b/mh/mh_init.c index 1d8e2d74e..50c21329c 100644 --- a/mh/mh_init.c +++ b/mh/mh_init.c @@ -544,7 +544,7 @@ mh_file_copy (const char *from, const char *to) return rc; } -static int +int _mh_delim (char *str) { if (str[0] == '-') @@ -679,12 +679,30 @@ mh_stream_to_message (stream_t instream) struct msg_envelope *mp; envelope_t env; message_t msg; + stream_t draftstream; + int rc; + if ((rc = mhdraft_stream_create (&draftstream, instream, 0))) + { + mh_error(_("cannot create draft message stream: %s"), + mu_strerror (rc)); + return NULL; + } + + if ((rc = stream_open (draftstream))) + { + mh_error(_("cannot open draft message stream: %s"), + mu_strerror (rc)); + stream_destroy (&draftstream, stream_get_owner (draftstream)); + return NULL; + } + restore_envelope (instream, &mp); + if (message_create (&msg, mp)) return NULL; - message_set_stream (msg, instream, mp); + message_set_stream (msg, draftstream, mp); if (envelope_create (&env, msg)) return NULL; |