aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-02-24 11:47:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-02-24 11:47:14 +0800
commitfc1fc5f041bcd2d6446e988336061926a244e254 (patch)
tree2d0c0222faecf37c884c6c694d6952e326f58538 /camel
parent6e61ef2ee4b9729c0122acc04127370b94edf4d6 (diff)
downloadgsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar.gz
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar.bz2
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar.lz
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar.xz
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.tar.zst
gsoc2013-evolution-fc1fc5f041bcd2d6446e988336061926a244e254.zip
Do it the same way we just made the sendmail code do it.
2003-02-23 Jeffrey Stedfast <fejj@ximian.com> * providers/smtp/camel-smtp-transport.c (smtp_data): Do it the same way we just made the sendmail code do it. * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to): My last change but in a better way. svn path=/trunk/; revision=20023
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c71
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c42
3 files changed, 61 insertions, 60 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 1b1423531d..5d50e60964 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-23 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/smtp/camel-smtp-transport.c (smtp_data): Do it the
+ same way we just made the sendmail code do it.
+
+ * providers/sendmail/camel-sendmail-transport.c
+ (sendmail_send_to): My last change but in a better way.
+
2003-02-22 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_data): Remove all
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
index 7b3b7d0145..70abc68026 100644
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ b/camel/providers/sendmail/camel-sendmail-transport.c
@@ -85,10 +85,9 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
CamelAddress *from, CamelAddress *recipients,
CamelException *ex)
{
+ struct _header_raw *header, *savedbcc, *n, *tail;
const char *from_addr, *addr, **argv;
int i, len, fd[2], nullfd, wstat;
- struct _header_raw *header;
- GSList *n, *bcc = NULL;
sigset_t mask, omask;
CamelStream *out;
pid_t pid;
@@ -117,18 +116,23 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
argv[i + 5] = NULL;
- /* copy and remove the bcc headers */
- header = CAMEL_MIME_PART (message)->headers;
- while (header) {
- if (!strcasecmp (header->name, "Bcc"))
- bcc = g_slist_append (bcc, g_strdup (header->value));
- header = header->next;
- }
-
- n = bcc;
- while (n) {
- camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
- n = n->next;
+ /* unlink the bcc headers */
+ savedbcc = NULL;
+ tail = (struct _header_raw *) &savedbcc;
+
+ header = (struct _header_raw *) &CAMEL_MIME_PART (message)->headers;
+ n = header->next;
+ while (n != NULL) {
+ if (!strcasecmp (header->name, "Bcc")) {
+ header->next = n->next;
+ tail->next = n;
+ n->next = NULL;
+ tail = n;
+ } else {
+ header = n;
+ }
+
+ n = header->next;
}
if (pipe (fd) == -1) {
@@ -136,7 +140,11 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
_("Could not create pipe to sendmail: "
"%s: mail not sent"),
g_strerror (errno));
- goto exception;
+
+ /* restore the bcc headers */
+ header->next = savedbcc;
+
+ return FALSE;
}
/* Block SIGCHLD so the calling application doesn't notice
@@ -156,7 +164,10 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
sigprocmask (SIG_SETMASK, &omask, NULL);
g_free (argv);
- goto exception;
+ /* restore the bcc headers */
+ header->next = savedbcc;
+
+ return FALSE;
case 0:
/* Child process */
nullfd = open ("/dev/null", O_RDWR);
@@ -187,7 +198,10 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
sigprocmask (SIG_SETMASK, &omask, NULL);
- goto exception;
+ /* restore the bcc headers */
+ header->next = savedbcc;
+
+ return FALSE;
}
camel_object_unref (CAMEL_OBJECT (out));
@@ -198,14 +212,8 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
sigprocmask (SIG_SETMASK, &omask, NULL);
- /* add the bcc headers back */
- while (bcc) {
- n = bcc->next;
- camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data);
- g_free (bcc->data);
- g_slist_free_1 (bcc);
- bcc = n;
- }
+ /* restore the bcc headers */
+ header->next = savedbcc;
if (!WIFEXITED (wstat)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -229,19 +237,6 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
}
return TRUE;
-
- exception:
-
- /* add the bcc headers back */
- while (bcc) {
- n = bcc->next;
- camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data);
- g_free (bcc->data);
- g_slist_free_1 (bcc);
- bcc = n;
- }
-
- return FALSE;
}
static char *
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 16a4749779..0acdfeb4d1 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -1222,11 +1222,10 @@ static gboolean
smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean has_8bit_parts, CamelException *ex)
{
CamelBestencEncoding enctype = CAMEL_BESTENC_8BIT;
+ struct _header_raw *header, *savedbcc, *n, *tail;
char *cmdbuf, *respbuf = NULL;
CamelStreamFilter *filtered_stream;
CamelMimeFilter *crlffilter;
- struct _header_raw *header;
- GSList *n, *bcc = NULL;
int ret;
/* if the message contains 8bit/binary mime parts and the server
@@ -1282,31 +1281,30 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter));
camel_object_unref (CAMEL_OBJECT (crlffilter));
- /* copy and remove the bcc headers */
- header = CAMEL_MIME_PART (message)->headers;
- while (header) {
- if (!strcasecmp (header->name, "Bcc"))
- bcc = g_slist_append (bcc, g_strdup (header->value));
- header = header->next;
- }
-
- n = bcc;
- while (n) {
- camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
- n = n->next;
+ /* unlink the bcc headers */
+ savedbcc = NULL;
+ tail = (struct _header_raw *) &savedbcc;
+
+ header = (struct _header_raw *) &CAMEL_MIME_PART (message)->headers;
+ n = header->next;
+ while (n != NULL) {
+ if (!strcasecmp (header->name, "Bcc")) {
+ header->next = n->next;
+ tail->next = n;
+ n->next = NULL;
+ tail = n;
+ } else {
+ header = n;
+ }
+
+ n = header->next;
}
/* write the message */
ret = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream));
- /* add the bcc headers back */
- while (bcc) {
- n = bcc->next;
- camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data);
- g_free (bcc->data);
- g_slist_free_1 (bcc);
- bcc = n;
- }
+ /* restore the bcc headers */
+ header->next = savedbcc;
if (ret == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,