diff options
Diffstat (limited to 'libproto/mbox/mbox.c')
-rw-r--r-- | libproto/mbox/mbox.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c index 62507657e..cc412ff37 100644 --- a/libproto/mbox/mbox.c +++ b/libproto/mbox/mbox.c @@ -25,12 +25,13 @@ # include <config.h> #endif #include <mbox0.h> #include <mailutils/cstr.h> #include <mailutils/io.h> +#include <mailutils/filter.h> #define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED) #define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2) static int mbox_is_updated (mu_mailbox_t mailbox); static int mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted); @@ -1030,13 +1031,13 @@ uid_to_stream (mu_stream_t ostr, mu_message_t msg, mbox_data_t mud, int flags) /* Append MSG to stream OSTR in its current position */ static int append_message_to_stream (mu_stream_t ostr, mu_message_t msg, mbox_data_t mud, int flags) { int status; - mu_stream_t istr; + mu_stream_t istr, flt; status = msg_envelope_to_stream (ostr, msg); if (status) return status; if (flags & MBOX_EXPUNGE) @@ -1081,16 +1082,24 @@ append_message_to_stream (mu_stream_t ostr, mu_message_t msg, else { status = mu_message_get_streamref (msg, &istr); if (status) return status; } - status = mu_stream_copy (ostr, istr, 0, NULL); - mu_stream_destroy (&istr); + + status = mu_filter_create (&flt, istr, "FROM", + MU_FILTER_ENCODE, MU_STREAM_READ); + mu_stream_unref (istr); if (status == 0) - status = mu_stream_write (ostr, "\n", 1, NULL); + { + status = mu_stream_copy (ostr, flt, 0, NULL); + mu_stream_destroy (&flt); + if (status == 0) + status = mu_stream_write (ostr, "\n", 1, NULL); + } + return status; } static int mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) { |