diff options
author | Not Zed <NotZed@Ximian.com> | 2005-03-04 11:15:38 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-03-04 11:15:38 +0800 |
commit | 2fad54d49c8a2380e9ab135160652c9aec6e8b7a (patch) | |
tree | 23c15b438926f27c41d44931bf9448f76311aa54 /mail/em-composer-utils.c | |
parent | 65d329aa11b37ca3fad9c76db0c8fa92ae451800 (diff) | |
download | gsoc2013-evolution-2fad54d49c8a2380e9ab135160652c9aec6e8b7a.tar.gz gsoc2013-evolution-2fad54d49c8a2380e9ab135160652c9aec6e8b7a.tar.zst gsoc2013-evolution-2fad54d49c8a2380e9ab135160652c9aec6e8b7a.zip |
** See bug #66592
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.
svn path=/trunk/; revision=28950
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 128 |
1 files changed, 33 insertions, 95 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index d47563603d..4f8ecb951a 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -228,18 +228,19 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag } 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 *composer, gboolean post, gboolean save_html_ } 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 *composer, gboolean post, gboolean save_html_ 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 *composer, gboolean post, gboolean save_html_ 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); } |