From 1cb2bd29bec3bfb81e06c0f9fc11e4ae3020757a Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Fri, 8 Jun 2001 20:00:54 +0000 Subject: When saving a draft, attach information about the From: identity via 2001-06-08 Jon Trowbridge * e-msg-composer.c (save_draft): When saving a draft, attach information about the From: identity via X-Evolution-Account. This lets us select the correct identity when we edit it later. (e_msg_composer_new_with_message): If the message we are editting is tagged with an account (via X-Evolution-Account), make sure that the composer chooses that account's identity by default. svn path=/trunk/; revision=10161 --- composer/e-msg-composer.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 98062f786f..1248d002b5 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -41,6 +41,7 @@ #endif #include +#include #include #include #include @@ -907,6 +908,10 @@ save_draft (EMsgComposer *composer, int quitok) composer->send_html = TRUE; msg = e_msg_composer_get_message (composer); composer->send_html = old_send_html; + + /* Attach account info to the draft. */ + if (account && account->name) + camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Account", account->name); info = g_new0 (CamelMessageInfo, 1); info->flags = CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN; @@ -2217,6 +2222,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) const gchar *subject; EMsgComposer *new; guint len, i; + const gchar *account_name = NULL; g_return_val_if_fail (gtk_main_level () > 0, NULL); @@ -2225,7 +2231,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) return NULL; subject = camel_mime_message_get_subject (msg); - + to = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_TO); cc = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_CC); bcc = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_BCC); @@ -2272,7 +2278,14 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) } } - e_msg_composer_set_headers (new, NULL, To, Cc, Bcc, subject); + account_name = camel_medium_get_header (CAMEL_MEDIUM (msg), "X-Evolution-Account"); + if (account_name) { + while (*account_name && isspace (*account_name)) + ++account_name; + camel_medium_remove_header (CAMEL_MEDIUM (msg), "X-Evolution-Account"); + } + + e_msg_composer_set_headers (new, account_name, To, Cc, Bcc, subject); free_recipients (To); free_recipients (Cc); -- cgit v1.2.3