From f88c5b4073c70a294157094d2108795c3f160d32 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 13 Jan 2001 05:59:32 +0000 Subject: Get the X-Evolution-Transport URL and use that if it exists, else fall 2001-01-13 Jeffrey Stedfast * mail-ops.c (do_send_queue): Get the X-Evolution-Transport URL and use that if it exists, else fall back on the default transport. * mail-callbacks.c (composer_postpone_cb): Set an X-Evolution-Transport header. svn path=/trunk/; revision=7474 --- mail/ChangeLog | 9 +++++++++ mail/mail-callbacks.c | 10 ++++++++-- mail/mail-ops.c | 10 +++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index f2dbf4a922..8ccd4fc80f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2001-01-13 Jeffrey Stedfast + + * mail-ops.c (do_send_queue): Get the X-Evolution-Transport URL + and use that if it exists, else fall back on the default + transport. + + * mail-callbacks.c (composer_postpone_cb): Set an + X-Evolution-Transport header. + 2001-01-12 Jeffrey Stedfast * Makefile.am: Removed GPG_* variables. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 636f95aecd..47122737c3 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -208,8 +208,6 @@ send_queued_mail (GtkWidget *widget, gpointer user_data) return; } - /* FIXME: use the preferred transport for each message */ - account = mail_config_get_default_account (); if (!account || !account->transport) { GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data), @@ -363,6 +361,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data) void composer_postpone_cb (EMsgComposer *composer, gpointer data) { + const MailConfigAccount *account = NULL; extern CamelFolder *outbox_folder; CamelMimeMessage *message; struct post_send_data *psd = data; @@ -380,6 +379,13 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data) } } + /* Attach a X-Evolution-Transport header so we know which account + to use when it gets sent later. */ + account = e_msg_composer_get_preferred_account (composer); + if (!account) + account = mail_config_get_default_account (); + camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url); + /* Save the message in Outbox */ mail_do_append_mail (outbox_folder, message, NULL); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 6dec663e7b..27351fe700 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -701,6 +701,7 @@ do_send_queue (gpointer in_data, gpointer op_data, CamelException *ex) for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; + char *transport_url = NULL; message = camel_folder_get_message (input->folder_queue, uids->pdata[i], ex); if (camel_exception_is_set (ex)) @@ -710,7 +711,14 @@ do_send_queue (gpointer in_data, gpointer op_data, CamelException *ex) camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0); - xport = camel_session_get_transport (session, input->xport_uri, ex); + /* Get the preferred transport URI */ + transport_url = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport")); + if (transport_url) + camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); + + xport = camel_session_get_transport (session, transport_url ? transport_url : input->xport_uri, ex); + g_free (transport_url); + if (camel_exception_is_set (ex)) break; -- cgit v1.2.3