From dfc8e2ad3f8f0ce91c16a6538e28491699b0bc99 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 23 Apr 2001 02:15:45 +0000 Subject: Only set the X-Evolution-* header if that value is non-NULL. 2001-04-22 Jeffrey Stedfast * mail-callbacks.c (composer_get_message): Only set the X-Evolution-* header if that value is non-NULL. * mail-ops.c (mail_send_message): Lets do proper refcounting on the sent-folder. Also, g_strdup() the sent_folder_uri since we later free it. If we don't, then we get lovely corrupt memory. svn path=/trunk/; revision=9498 --- mail/ChangeLog | 7 +++++++ mail/mail-callbacks.c | 14 +++++++++++--- mail/mail-ops.c | 24 +++++++++++++++--------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index a312b8ae00..3118d588dd 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,12 @@ 2001-04-22 Jeffrey Stedfast + * mail-callbacks.c (composer_get_message): Only set the + X-Evolution-* header if that value is non-NULL. + + * mail-ops.c (mail_send_message): Lets do proper refcounting on + the sent-folder. Also, g_strdup() the sent_folder_uri since we + later free it. If we don't, then we get lovely corrupt memory. + * mail-crypto.c (mail_crypto_pgp_mime_part_sign): Make sure we have a context before we try and use it. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 871a63325e..b59e4efcb2 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -330,9 +330,17 @@ composer_get_message (EMsgComposer *composer) /* Add info about the sending account */ account = e_msg_composer_get_preferred_account (composer); if (account) { - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name); - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url); - camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri); + if (account->name) + camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", + account->name); + + if (account->transport && account->transport->url) + camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", + account->transport->url); + + if (account->sent_folder_uri) + camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", + account->sent_folder_uri); } return message; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 1ee9de5369..badb3b777f 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -502,31 +502,33 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account"); if (header) { const MailConfigAccount *account; - + account = mail_config_get_account_by_name (header); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Account"); if (account) { transport_url = g_strdup (account->transport->url); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); - sent_folder_uri = account->sent_folder_uri; + sent_folder_uri = g_strdup (account->sent_folder_uri); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); } } + if (!transport_url) { header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); if (header) { - transport_url = g_strstrip(g_strdup (header)); + transport_url = g_strstrip (g_strdup (header)); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); } } + if (!sent_folder_uri) { header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); if (header) { - sent_folder_uri = g_strstrip(g_strdup (header)); + sent_folder_uri = g_strstrip (g_strdup (header)); camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"); } } - + xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex); g_free (transport_url); if (!xport) { @@ -553,13 +555,18 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte folder = mail_tool_uri_to_folder (sent_folder_uri, NULL); if (!folder) { /* FIXME */ + camel_object_ref (CAMEL_OBJECT (sent_folder)); folder = sent_folder; } - } else + } else { + camel_object_ref (CAMEL_OBJECT (sent_folder)); folder = sent_folder; - - if (folder) + } + + if (folder) { camel_folder_append_message (folder, message, info, ex); + camel_object_unref (CAMEL_OBJECT (folder)); + } camel_message_info_free (info); } @@ -997,7 +1004,6 @@ add_vtrash_info (CamelFolderInfo *info) g_return_if_fail (info != NULL); for (fi = info; fi->sibling; fi = fi->sibling) { - g_warning ("add_vtrash_info(): url is %s", fi->url); if (!strcmp (fi->name, _("Trash"))) break; } -- cgit