diff options
-rw-r--r-- | composer/ChangeLog | 9 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 17 |
2 files changed, 24 insertions, 2 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index cc55320bcb..6a1d6aea09 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,12 @@ +2001-06-08 Jon Trowbridge <trow@ximian.com> + + * 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. + 2001-06-08 Dan Winship <danw@ximian.com> * e-msg-composer.c (best_charset): Don't use the default charset 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 <errno.h> +#include <ctype.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-config.h> #include <libgnomeui/gnome-app.h> @@ -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); |