From a60f38bc6e65a53c3598e9e22ebf5bfa3a76e27e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 13 Oct 2001 18:21:31 +0000 Subject: Replace the Bcc headers in a single location and don't flush the data 2001-10-13 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c (smtp_data): Replace the Bcc headers in a single location and don't flush the data unless the write was successful. svn path=/trunk/; revision=13662 --- camel/ChangeLog | 6 +++++ camel/providers/smtp/camel-smtp-transport.c | 37 +++++++++++++---------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 30300365d2..91f1d02e5e 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2001-10-13 Jeffrey Stedfast + + * providers/smtp/camel-smtp-transport.c (smtp_data): Replace the + Bcc headers in a single location and don't flush the data unless + the write was successful. + 2001-10-12 Jeffrey Stedfast * Makefile.am: Remove the stripheader filter from the build. diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 54eecebde7..48972445e1 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -1002,7 +1002,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter)); camel_object_unref (CAMEL_OBJECT (crlffilter)); - /* copy the bcc headers */ + /* copy and remove the bcc headers */ header = CAMEL_MIME_PART (message)->headers; while (header) { if (!g_strcasecmp (header->name, "Bcc")) @@ -1012,8 +1012,21 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); + /* write the message */ ret = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream)); - if (ret == -1 || camel_stream_flush (CAMEL_STREAM (filtered_stream)) == -1) { + + /* add the bcc headers back */ + if (bcc) { + h = bcc; + while (h) { + camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data); + g_free (h->data); + h = h->next; + } + g_slist_free (bcc); + } + + if (ret == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("DATA send timed out: message termination: " "%s: mail not sent"), @@ -1021,29 +1034,11 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi camel_object_unref (CAMEL_OBJECT (filtered_stream)); - if (bcc) { - h = bcc; - while (h) { - camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data); - g_free (h->data); - h = h->next; - } - g_slist_free (bcc); - } - return FALSE; } + camel_stream_flush (CAMEL_STREAM (filtered_stream)); camel_object_unref (CAMEL_OBJECT (filtered_stream)); - if (bcc) { - h = bcc; - while (h) { - camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data); - g_free (h->data); - h = h->next; - } - g_slist_free (bcc); - } /* terminate the message body */ -- cgit v1.2.3