diff options
author | Meilof Veeningen <meilof@wanadoo.nl> | 2004-01-13 06:22:50 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-01-13 06:22:50 +0800 |
commit | 2505d230498c0f35822e7d10502bb3f899fdf876 (patch) | |
tree | 3f187bc063daa0f0a99b248c6a2c4b613a184c95 /mail/em-composer-utils.c | |
parent | 39a61d9ccdf9d19a30d07a49c8d4919689845465 (diff) | |
download | gsoc2013-evolution-2505d230498c0f35822e7d10502bb3f899fdf876.tar.gz gsoc2013-evolution-2505d230498c0f35822e7d10502bb3f899fdf876.tar.zst gsoc2013-evolution-2505d230498c0f35822e7d10502bb3f899fdf876.zip |
support for posting both to mail and to (multiple) folders
2004-01-12 Meilof Veeningen <meilof@wanadoo.nl>
* em-composer-utils.c: support for posting both to mail and to
(multiple) folders
* em-folder-browser.c: use em_utils_post_to_folder (works with NNTP)
* em-folder-selection-button.[ch]: added multiple selection mode
* em-folder-selector.[ch]: idem
* em-folder-tree.[ch]: added multiple selection mode, no longer show
disabled accounts
* em-utils.c: various changes to allow posting to (multiple) folders
* em-subscribe-editor.c: double-clicking a node in the editor updates
it directly
* mail-ops.c: for appending messages, set the "X-Mailer" header
svn path=/trunk/; revision=24182
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 120 |
1 files changed, 78 insertions, 42 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index bc076a7f77..09ca8a8b4f 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -231,7 +231,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag } static CamelMimeMessage * -composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_object_data) +composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_object_data, gboolean *no_recipients) { CamelMimeMessage *message = NULL; EABDestination **recipients, **recipients_bcc; @@ -296,10 +296,15 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ camel_object_unref (cia); /* I'm sensing a lack of love, er, I mean recipients. */ - if (num == 0 && !post) { - e_notice ((GtkWindow *) composer, GTK_MESSAGE_WARNING, - _("You must specify recipients in order to send this message.")); - goto finished; + if (num == 0) { + if (post) { + if (no_recipients) + *no_recipients = TRUE; + } else { + e_notice ((GtkWindow *) composer, GTK_MESSAGE_WARNING, + _("You must specify recipients in order to send this message.")); + goto finished; + } } if (num > 0 && (num == num_bcc || shown == 0)) { @@ -389,55 +394,85 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data) CamelMimeMessage *message; CamelMessageInfo *info; struct _send_data *send; - gboolean post = FALSE; - CamelFolder *folder; + gboolean no_recipients = FALSE; + CamelFolder *mail_folder = NULL, *tmpfldr; + GList *post_folders = NULL, *post_ptr; XEvolution *xev; - char *url; - - url = e_msg_composer_hdrs_get_post_to ((EMsgComposerHdrs *) composer->hdrs); - if (url && *url) { - post = TRUE; - - mail_msg_wait (mail_get_folder (url, 0, got_post_folder, &folder, mail_thread_new)); - - if (!folder) { - g_free (url); - return; - } - } else { - folder = outbox_folder; - camel_object_ref (folder); + 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); } - g_free (url); + mail_folder = outbox_folder; + camel_object_ref (mail_folder); + + if (!post_folders && !mail_folder) + return; - message = composer_get_message (composer, post, FALSE); - if (!message) + if (!(message = composer_get_message (composer, post_folders != NULL, FALSE, &no_recipients))) return; - if (post) { + 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 (); + info->flags = CAMEL_MESSAGE_SEEN; + + 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 (); + info->flags = CAMEL_MESSAGE_SEEN; + + 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); + } } - info = camel_message_info_new (); - info->flags = CAMEL_MESSAGE_SEEN; - - send = g_malloc (sizeof (*send)); - send->emcs = user_data; - if (send->emcs) - emcs_ref (send->emcs); - send->send = !post; - send->composer = composer; - g_object_ref (composer); - gtk_widget_hide (GTK_WIDGET (composer)); - - e_msg_composer_set_enable_autosave (composer, FALSE); - - mail_append_mail (folder, message, info, composer_send_queued_cb, send); camel_object_unref (message); - camel_object_unref (folder); } struct _save_draft_info { @@ -456,6 +491,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i if (!ok) goto done; + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (sdi->composer->editor_engine, "saved", &ev); CORBA_exception_free (&ev); |