[evolution-patches] 66592, unable to add to/remove postto and other bugs
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] 66592, unable to add to/remove postto and other bugs
- Date: Thu, 03 Mar 2005 11:36:54 +0800
this patch does a lot more than fix this bug, because i saw the code did some other silly things that needed fixing. this also fixes an issue that if you save a posting message to a draft (or autosave) it wont restore the post-to values properly. it also sends all outgoing messages through the outbox queue, rather than handling post-to's separately. and it fixes the account-id not being saved in messages properly; i've had multiple occasions when the account would match the wrong one based just on the name, so changing the account settings had no effect on the mail in the queue.
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3600
diff -u -p -r1.3600 ChangeLog
--- mail/ChangeLog 2 Mar 2005 05:23:45 -0000 1.3600
+++ mail/ChangeLog 3 Mar 2005 03:25:31 -0000
@@ -1,3 +1,37 @@
+2005-03-03 Not Zed <NotZed Ximian com>
+
+ ** See bug #66592
+
+ * mail-tools.c (mail_tool_make_message_attachment): jus call
+ camel_medium_remove_header to remove the bcc header, don't need to
+ loop.
+
+ * mail-ops.c (mail_send_message): try to find the account by uid
+ first, fall back to name.
+
+ * em-composer-utils.c (composer_get_message): set
+ x-evolution-account by uid, not name.
+
+2005-03-02 Not Zed <NotZed Ximian com>
+
+ ** See bug #66592
+
+ * em-composer-utils.c (got_post_folder): no longer needed.
+ (composer_get_message): remove 'post' and 'no_recipeints' args.
+
+ * mail-ops.c (mail_send_message): change for xev changes. Also
+ handle postto if set.
+
+ * mail-tools.c (mail_tool_remove_xevolution_headers)
+ (mail_tool_restore_xevolution_headers): fix for api change.
+ (mail_tool_destroy_xevolution): remove.
+
+ * mail-tools.h: remove XEvolution, just use a struct _header_raw
+ for it.
+
+ * em-composer-utils.c (em_utils_composer_send_cb): don't post
+ message here, just queue it like any other outgoing mail.
+
2005-03-01 Not Zed <NotZed Ximian com>
* message-list.c: include atkutil.h
Index: mail/em-composer-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.c,v
retrieving revision 1.33
diff -u -p -r1.33 em-composer-utils.c
--- mail/em-composer-utils.c 25 Feb 2005 03:51:53 -0000 1.33
+++ mail/em-composer-utils.c 3 Mar 2005 03:25:32 -0000
@@ -228,18 +228,19 @@ composer_send_queued_cb (CamelFolder *fo
}
static CamelMimeMessage *
-composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_object_data, gboolean *no_recipients)
+composer_get_message (EMsgComposer *composer, gboolean save_html_object_data)
{
CamelMimeMessage *message = NULL;
EDestination **recipients, **recipients_bcc;
gboolean send_html, confirm_html;
CamelInternetAddress *cia;
int hidden = 0, shown = 0;
- int num = 0, num_bcc = 0;
+ int num = 0, num_bcc = 0, num_post = 0;
const char *subject;
GConfClient *gconf;
EAccount *account;
int i;
+ GList *postlist;
gconf = mail_config_get_gconf_client ();
@@ -291,16 +292,16 @@ composer_get_message (EMsgComposer *comp
}
camel_object_unref (cia);
+
+ postlist = e_msg_composer_hdrs_get_post_to((EMsgComposerHdrs *) composer->hdrs);
+ num_post = g_list_length(postlist);
+ g_list_foreach(postlist, (GFunc)g_free, NULL);
+ g_list_free(postlist);
/* I'm sensing a lack of love, er, I mean recipients. */
- if (num == 0) {
- if (post) {
- if (no_recipients)
- *no_recipients = TRUE;
- } else {
- e_error_run((GtkWindow *)composer, "mail:send-no-recipients", NULL);
- goto finished;
- }
+ if (num == 0 && num_post == 0) {
+ e_error_run((GtkWindow *)composer, "mail:send-no-recipients", NULL);
+ goto finished;
}
if (num > 0 && (num == num_bcc || shown == 0)) {
@@ -348,7 +349,8 @@ composer_get_message (EMsgComposer *comp
account = e_msg_composer_get_preferred_account (composer);
if (account) {
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ /* FIXME: Why isn't this crap just in e_msg_composer_get_message? */
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->uid);
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->id->organization && *account->id->organization) {
@@ -368,101 +370,37 @@ composer_get_message (EMsgComposer *comp
return message;
}
-static void
-got_post_folder (char *uri, CamelFolder *folder, void *data)
-{
- CamelFolder **fp = data;
-
- *fp = folder;
-
- if (folder)
- camel_object_ref (folder);
-}
-
void
em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
{
CamelMimeMessage *message;
CamelMessageInfo *info;
struct _send_data *send;
- gboolean no_recipients = FALSE;
- CamelFolder *mail_folder = NULL, *tmpfldr;
- GList *post_folders = NULL, *post_ptr;
- XEvolution *xev;
- GList *postlist;
-
- postlist = e_msg_composer_hdrs_get_post_to ((EMsgComposerHdrs *) composer->hdrs);
- while (postlist) {
- mail_msg_wait (mail_get_folder (postlist->data, 0, got_post_folder, &tmpfldr, mail_thread_new));
- if (tmpfldr)
- post_folders = g_list_append (post_folders, tmpfldr);
- postlist = g_list_next (postlist);
- }
-
+ CamelFolder *mail_folder;
+
+ if (!(message = composer_get_message (composer, FALSE)))
+ return;
+
mail_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
camel_object_ref (mail_folder);
- if (!post_folders && !mail_folder)
- return;
-
- if (!(message = composer_get_message (composer, post_folders != NULL, FALSE, &no_recipients)))
- return;
-
- if (no_recipients) {
- /* we're doing a post with no recipients */
- camel_object_unref (mail_folder);
- mail_folder = NULL;
- }
-
- if (mail_folder) {
- /* mail the message */
- info = camel_message_info_new(NULL);
- camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
-
- send = g_malloc (sizeof (*send));
- send->emcs = user_data;
- if (send->emcs)
- emcs_ref (send->emcs);
- send->send = TRUE;
- send->composer = composer;
- g_object_ref (composer);
- gtk_widget_hide (GTK_WIDGET (composer));
-
- e_msg_composer_set_enable_autosave (composer, FALSE);
-
- mail_append_mail (mail_folder, message, info, composer_send_queued_cb, send);
- camel_object_unref (mail_folder);
- }
-
- if (post_folders) {
- /* Remove the X-Evolution* headers if we are in Post-To mode */
- xev = mail_tool_remove_xevolution_headers (message);
- mail_tool_destroy_xevolution (xev);
-
- /* mail the message */
- info = camel_message_info_new(NULL);
- camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
+ /* mail the message */
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
+
+ send = g_malloc (sizeof (*send));
+ send->emcs = user_data;
+ if (send->emcs)
+ emcs_ref (send->emcs);
+ send->send = TRUE;
+ send->composer = composer;
+ g_object_ref (composer);
+ gtk_widget_hide (GTK_WIDGET (composer));
+
+ e_msg_composer_set_enable_autosave (composer, FALSE);
- post_ptr = post_folders;
- while (post_ptr) {
- send = g_malloc (sizeof (*send));
- send->emcs = user_data;
- if (send->emcs)
- emcs_ref (send->emcs);
- send->send = FALSE;
- send->composer = composer;
- g_object_ref (composer);
- gtk_widget_hide (GTK_WIDGET (composer));
-
- e_msg_composer_set_enable_autosave (composer, FALSE);
-
- mail_append_mail ((CamelFolder *) post_ptr->data, message, info, composer_send_queued_cb, send);
- camel_object_unref ((CamelFolder *) post_ptr->data);
-
- post_ptr = g_list_next (post_ptr);
- }
- }
-
+ mail_append_mail (mail_folder, message, info, composer_send_queued_cb, send);
+ camel_object_unref (mail_folder);
camel_object_unref (message);
}
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.444
diff -u -p -r1.444 mail-ops.c
--- mail/mail-ops.c 8 Feb 2005 06:53:11 -0000 1.444
+++ mail/mail-ops.c 3 Mar 2005 03:25:32 -0000
@@ -448,58 +448,54 @@ mail_send_message(CamelFolder *queue, co
EAccount *account = NULL;
const CamelInternetAddress *iaddr;
CamelAddress *from, *recipients;
- CamelMessageInfo *info;
+ CamelMessageInfo *info = NULL;
CamelTransport *xport = NULL;
char *transport_url = NULL;
char *sent_folder_uri = NULL;
- const char *resent_from;
+ const char *resent_from, *tmp;
CamelFolder *folder = NULL;
GString *err = NULL;
- XEvolution *xev;
+ struct _camel_header_raw *xev, *header;
CamelMimeMessage *message;
int i;
message = camel_folder_get_message(queue, uid, ex);
if (!message)
return;
-
+
camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT);
-
+
+ err = g_string_new("");
xev = mail_tool_remove_xevolution_headers (message);
-
- if (xev->account) {
+
+ tmp = camel_header_raw_find(&xev, "X-Evolution-Account", NULL);
+ if (tmp) {
char *name;
- name = g_strstrip (g_strdup (xev->account));
- account = mail_config_get_account_by_name (name);
- g_free (name);
-
- if (account) {
+ name = g_strstrip(g_strdup(tmp));
+ if ((account = mail_config_get_account_by_uid(name))
+ /* 'old' x-evolution-account stored the name, how silly */
+ || (account = mail_config_get_account_by_name(name))) {
if (account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
sent_folder_uri = g_strdup (account->sent_folder_uri);
}
+ g_free(name);
}
if (!account) {
/* default back to these headers */
- if (xev->transport)
- transport_url = g_strstrip (g_strdup (xev->transport));
+ tmp = camel_header_raw_find(&xev, "X-Evolution-Transport", NULL);
+ if (tmp)
+ transport_url = g_strstrip(g_strdup(tmp));
- if (xev->fcc)
- sent_folder_uri = g_strstrip (g_strdup (xev->fcc));
+ tmp = camel_header_raw_find(&xev, "X-Evolution-Fcc", NULL);
+ if (tmp)
+ sent_folder_uri = g_strstrip(g_strdup(tmp));
}
-
- xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex);
- g_free (transport_url);
- if (!xport) {
- mail_tool_restore_xevolution_headers (message, xev);
- mail_tool_destroy_xevolution (xev);
- g_free (sent_folder_uri);
- return;
- }
-
+
+ /* Check for email sending */
from = (CamelAddress *) camel_internet_address_new ();
resent_from = camel_medium_get_header (CAMEL_MEDIUM (message), "Resent-From");
if (resent_from) {
@@ -517,24 +513,42 @@ mail_send_message(CamelFolder *queue, co
iaddr = camel_mime_message_get_recipients (message, type);
camel_address_cat (recipients, CAMEL_ADDRESS (iaddr));
}
-
- camel_transport_send_to (xport, message, from, recipients, ex);
- camel_object_unref (recipients);
- camel_object_unref (from);
-
- mail_tool_restore_xevolution_headers (message, xev);
- mail_tool_destroy_xevolution (xev);
-
- camel_object_unref (xport);
- if (camel_exception_is_set (ex)) {
- g_free (sent_folder_uri);
- return;
+
+ if (camel_address_length(recipients) > 0) {
+ xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex);
+ if (camel_exception_is_set(ex))
+ goto exit;
+
+ camel_transport_send_to(xport, message, from, recipients, ex);
+ if (camel_exception_is_set(ex))
+ goto exit;
}
-
- /* post-process */
- err = g_string_new("");
+
+ /* Now check for posting, failures are ignored */
info = camel_message_info_new(NULL);
camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
+ camel_mime_message_set_date(message, CAMEL_MESSAGE_DATE_CURRENT, 0);
+
+ for (header = xev;header;header=header->next) {
+ char *uri;
+
+ if (strcmp(header->name, "X-Evolution-PostTo") != 0)
+ continue;
+
+ /* TODO: don't lose errors */
+
+ uri = g_strstrip(g_strdup(header->value));
+ folder = mail_tool_uri_to_folder(uri, 0, NULL);
+ if (folder) {
+ camel_folder_append_message(folder, message, info, NULL, NULL);
+ camel_object_unref(folder);
+ folder = NULL;
+ }
+ g_free(uri);
+ }
+
+ /* post process */
+ mail_tool_restore_xevolution_headers (message, xev);
if (sent_folder_uri) {
folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex);
@@ -544,7 +558,6 @@ mail_send_message(CamelFolder *queue, co
sent_folder_uri, camel_exception_get_description (ex));
camel_exception_clear (ex);
}
- g_free (sent_folder_uri);
}
if (!folder) {
@@ -612,12 +625,24 @@ mail_send_message(CamelFolder *queue, co
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err->str);
}
- exit:
- g_string_free (err, TRUE);
- camel_folder_sync (folder, FALSE, NULL);
- camel_message_info_free (info);
- camel_object_unref (folder);
+exit:
+ if (folder) {
+ camel_folder_sync(folder, FALSE, NULL);
+ camel_object_unref(folder);
+ }
+ if (info)
+ camel_message_info_free(info);
+ camel_object_unref(recipients);
+ camel_object_unref(from);
+ if (xport)
+ camel_object_unref(xport);
+ g_free(sent_folder_uri);
+ g_free(transport_url);
+ camel_header_raw_clear(&xev);
+ g_string_free(err, TRUE);
camel_object_unref(message);
+
+ return;
}
/* ** SEND MAIL QUEUE ***************************************************** */
Index: mail/mail-tools.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-tools.c,v
retrieving revision 1.135
diff -u -p -r1.135 mail-tools.c
--- mail/mail-tools.c 1 Feb 2005 00:33:53 -0000 1.135
+++ mail/mail-tools.c 3 Mar 2005 03:25:33 -0000
@@ -206,62 +206,26 @@ mail_tool_generate_forward_subject (Came
return fwd_subj;
}
-XEvolution *
+struct _camel_header_raw *
mail_tool_remove_xevolution_headers (CamelMimeMessage *message)
{
- XEvolution *xev;
-
- xev = g_new (XEvolution, 1);
- xev->flags = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution"));
- xev->source = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Source"));
- xev->transport = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"));
- xev->account = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account"));
- xev->fcc = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"));
- xev->format = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Format"));
- xev->postto = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-PostTo"));
-
- /* rip off the X-Evolution* headers */
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Source");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Account");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Format");
- camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-PostTo");
-
- return xev;
-}
+ struct _camel_header_raw *scan, *list = NULL;
-void
-mail_tool_restore_xevolution_headers (CamelMimeMessage *message, XEvolution *xev)
-{
- if (xev->flags)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution", xev->flags);
- if (xev->source)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Source", xev->source);
- if (xev->transport)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", xev->transport);
- if (xev->account)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", xev->account);
- if (xev->fcc)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", xev->fcc);
- if (xev->format)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Format", xev->format);
- if (xev->postto)
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-PostTo", xev->postto);
+ for (scan = ((CamelMimePart *)message)->headers;scan;scan=scan->next)
+ if (!strncmp(scan->name, "X-Evolution", 11))
+ camel_header_raw_append(&list, scan->name, scan->value, scan->offset);
+
+ for (scan=list;scan;scan=scan->next)
+ camel_medium_remove_header((CamelMedium *)message, scan->name);
+
+ return list;
}
void
-mail_tool_destroy_xevolution (XEvolution *xev)
+mail_tool_restore_xevolution_headers (CamelMimeMessage *message, struct _camel_header_raw *xev)
{
- g_free (xev->flags);
- g_free (xev->source);
- g_free (xev->transport);
- g_free (xev->account);
- g_free (xev->format);
- g_free (xev->fcc);
- g_free (xev->postto);
- g_free (xev);
+ for (;xev;xev=xev->next)
+ camel_medium_add_header((CamelMedium *)message, xev->name, xev->value);
}
CamelMimePart *
@@ -269,7 +233,7 @@ mail_tool_make_message_attachment (Camel
{
CamelMimePart *part;
const char *subject;
- XEvolution *xev;
+ struct _camel_header_raw *xev;
char *desc;
subject = camel_mime_message_get_subject (message);
@@ -280,11 +244,10 @@ mail_tool_make_message_attachment (Camel
/* rip off the X-Evolution headers */
xev = mail_tool_remove_xevolution_headers (message);
- mail_tool_destroy_xevolution (xev);
+ camel_header_raw_clear(&xev);
/* remove Bcc headers */
- while (camel_medium_get_header (CAMEL_MEDIUM (message), "Bcc"))
- camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
part = camel_mime_part_new ();
camel_mime_part_set_disposition (part, "inline");
Index: mail/mail-tools.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-tools.h,v
retrieving revision 1.39
diff -u -p -r1.39 mail-tools.h
--- mail/mail-tools.h 3 May 2004 10:30:59 -0000 1.39
+++ mail/mail-tools.h 3 Mar 2005 03:25:33 -0000
@@ -29,16 +29,7 @@ struct _CamelFolder;
struct _CamelException;
struct _CamelMimeMessage;
struct _CamelMimePart;
-
-typedef struct _xevolution {
- char *flags;
- char *source;
- char *transport;
- char *account;
- char *fcc;
- char *format;
- char *postto;
-} XEvolution;
+struct _camel_header_raw;
/* Get the "inbox" for a url (uses global session) */
struct _CamelFolder *mail_tool_get_inbox (const char *url, struct _CamelException *ex);
@@ -50,9 +41,8 @@ struct _CamelFolder *mail_tool_get_trash
* and returns the path to the new movemail folder that was created. which shoudl be freed later */
char *mail_tool_do_movemail (const char *source_url, struct _CamelException *ex);
-XEvolution *mail_tool_remove_xevolution_headers (struct _CamelMimeMessage *message);
-void mail_tool_restore_xevolution_headers (struct _CamelMimeMessage *message, XEvolution *xev);
-void mail_tool_destroy_xevolution (XEvolution *xev);
+struct _camel_header_raw *mail_tool_remove_xevolution_headers (struct _CamelMimeMessage *message);
+void mail_tool_restore_xevolution_headers (struct _CamelMimeMessage *message, struct _camel_header_raw *);
/* Generates the subject for a message forwarding @msg */
gchar *mail_tool_generate_forward_subject (struct _CamelMimeMessage *msg);
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.683
diff -u -p -r1.683 ChangeLog
--- composer/ChangeLog 16 Feb 2005 18:29:57 -0000 1.683
+++ composer/ChangeLog 3 Mar 2005 03:25:33 -0000
@@ -1,3 +1,28 @@
+2005-03-03 Not Zed <NotZed Ximian com>
+
+ ** See bug #66592
+
+ * e-msg-composer.c (e_msg_composer_get_message_draft): set the uid
+ for the x-evolution-account, not the account name, which can
+ change.
+ (e_msg_composer_new_with_message): find the account by uid first,
+ fallback to name search.
+
+2005-03-02 Not Zed <NotZed Ximian com>
+
+ ** See bug #66592
+
+ * e-msg-composer.c (e_msg_composer_new_with_message): scan all
+ x-evolution-postto headers. This makes post-to drafts work
+ properly.
+ (e_msg_composer_new_with_message): change for XEvolution removal.
+
+ * e-msg-composer-hdrs.c (set_pair_visibility): track visibility
+ ourselves.
+ (e_msg_composer_hdrs_to_message_internal): dont use the visibility
+ mask to determine what headers to add, use the actually shown
+ list. Add back the x-evolution-postto headers.
+
2005-02-15 Jeffrey Stedfast <fejj novell com>
* e-msg-composer-select-file.c (select_attach_response): Fix
Index: composer/e-msg-composer-hdrs.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-hdrs.c,v
retrieving revision 1.133
diff -u -p -r1.133 e-msg-composer-hdrs.c
--- composer/e-msg-composer-hdrs.c 25 Jan 2005 02:25:24 -0000 1.133
+++ composer/e-msg-composer-hdrs.c 3 Mar 2005 03:25:33 -0000
@@ -83,6 +83,7 @@
typedef struct {
GtkWidget *label;
GtkWidget *entry;
+ int visible:1;
} EMsgComposerHdrPair;
struct _EMsgComposerHdrsPrivate {
@@ -676,6 +677,8 @@ set_pair_visibility (EMsgComposerHdrs *h
gtk_widget_hide (pair->label);
gtk_widget_hide (pair->entry);
}
+
+ pair->visible = TRUE;
}
static void
@@ -1000,7 +1003,7 @@ e_msg_composer_hdrs_to_message_internal
CamelInternetAddress *addr;
const char *subject;
char *header;
-
+
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
@@ -1023,7 +1026,7 @@ e_msg_composer_hdrs_to_message_internal
camel_object_unref (addr);
}
- if (hdrs->visible_mask & E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS) {
+ if (hdrs->priv->to.visible || hdrs->priv->cc.visible || hdrs->priv->bcc.visible) {
to_destv = e_msg_composer_hdrs_get_to (hdrs);
cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
@@ -1037,13 +1040,17 @@ e_msg_composer_hdrs_to_message_internal
e_destination_freev (bcc_destv);
}
-#if 0
- if (hdrs->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) {
- header = e_msg_composer_hdrs_get_post_to (hdrs);
- camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-PostTo", header);
- g_free (header);
+ if (hdrs->priv->post_to.visible) {
+ GList *post, *l;
+
+ camel_medium_remove_header((CamelMedium *)msg, "X-Evolution-PostTo");
+ post = e_msg_composer_hdrs_get_post_to(hdrs);
+ for (l=post;l;l=g_list_next(l)) {
+ camel_medium_add_header((CamelMedium *)msg, "X-Evolution-PostTo", l->data);
+ g_free(l->data);
+ }
+ g_list_free(post);
}
-#endif
}
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.499
diff -u -p -r1.499 e-msg-composer.c
--- composer/e-msg-composer.c 16 Feb 2005 05:33:15 -0000 1.499
+++ composer/e-msg-composer.c 3 Mar 2005 03:25:35 -0000
@@ -3992,8 +3992,8 @@ EMsgComposer *
e_msg_composer_new_with_message (CamelMimeMessage *message)
{
const CamelInternetAddress *to, *cc, *bcc;
- GList *To = NULL, *Cc = NULL, *Bcc = NULL;
- const char *format, *subject, *postto;
+ GList *To = NULL, *Cc = NULL, *Bcc = NULL, *postto = NULL;
+ const char *format, *subject;
EDestination **Tov, **Ccv, **Bccv;
GHashTable *auto_cc, *auto_bcc;
CamelContentType *content_type;
@@ -4002,17 +4002,27 @@ e_msg_composer_new_with_message (CamelMi
EAccount *account = NULL;
char *account_name;
EMsgComposer *new;
- XEvolution *xev;
+ struct _camel_header_raw *xev;
int len, i;
- postto = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-PostTo");
-
+ for (headers = CAMEL_MIME_PART (message)->headers;headers;headers = headers->next) {
+ if (!strcmp(headers->name, "X-Evolution-PostTo"))
+ postto = g_list_append(postto, g_strstrip(g_strdup(headers->value)));
+ }
+
new = create_composer (postto ? E_MSG_COMPOSER_VISIBLE_MASK_POST : E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
- if (!new)
+ if (!new) {
+ g_list_foreach(postto, (GFunc)g_free, NULL);
+ g_list_free(postto);
return NULL;
+ }
- if (postto)
- e_msg_composer_hdrs_set_post_to (E_MSG_COMPOSER_HDRS (new->hdrs), postto);
+ if (postto) {
+ e_msg_composer_hdrs_set_post_to_list(E_MSG_COMPOSER_HDRS (new->hdrs), postto);
+ g_list_foreach(postto, (GFunc)g_free, NULL);
+ g_list_free(postto);
+ postto = NULL;
+ }
/* Restore the Account preference */
account_name = (char *) camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account");
@@ -4020,7 +4030,9 @@ e_msg_composer_new_with_message (CamelMi
account_name = g_strdup (account_name);
g_strstrip (account_name);
- account = mail_config_get_account_by_name (account_name);
+ if ((account = mail_config_get_account_by_uid(account_name)) == NULL)
+ /* 'old' setting */
+ account = mail_config_get_account_by_name(account_name);
}
if (postto == NULL) {
@@ -4167,7 +4179,7 @@ e_msg_composer_new_with_message (CamelMi
/* Remove any other X-Evolution-* headers that may have been set */
xev = mail_tool_remove_xevolution_headers (message);
- mail_tool_destroy_xevolution (xev);
+ camel_header_raw_clear(&xev);
/* set extra headers */
headers = CAMEL_MIME_PART (message)->headers;
@@ -4742,7 +4754,7 @@ e_msg_composer_get_message_draft (EMsgCo
/* Attach account info to the draft. */
account = e_msg_composer_get_preferred_account (composer);
if (account && account->name)
- camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Account", account->name);
+ camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Account", account->uid);
/* build_message() set this to text/html since we set composer->send_html to
TRUE before calling e_msg_composer_get_message() */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]