diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-01-30 05:06:01 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-01-30 05:06:01 +0800 |
commit | 865606984fb9d3c1a3e6af99ceea17fac7c18b07 (patch) | |
tree | 592520727af3a87a5e5baa15685a10f65d116f8d /mail/mail-callbacks.c | |
parent | 85610de9fec51076b7ff834e22409a029d18a484 (diff) | |
download | gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.gz gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.zst gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.zip |
New function that implements the Redirect feature.
2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (redirect): New function that implements the
Redirect feature.
* mail-ops.c (mail_send_message): If we are redirecting a message,
get the Resent-* recipients otherwise get the normal To/Cc/Bcc
recipients and use them in the CamelTransport::send_to() method.
* mail-session.c (main_get_filter_driver): Set the beep_func to
the beep_cb, not the play_sound_func. Oops ;-)
* folder-browser-ui.c: Add Redirect bonobo verb thingy here.
(folder_browser_ui_set_selection_state): Add MessageRedirect to
the proper string arrays.
svn path=/trunk/; revision=15511
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r-- | mail/mail-callbacks.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index f84e9ec567..1a3cb3cedc 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1285,6 +1285,89 @@ forward (GtkWidget *widget, gpointer user_data) forward_message (user_data, style); } +static EMsgComposer * +redirect_get_composer (CamelMimeMessage *message) +{ + const MailConfigAccount *account = NULL; + const CamelInternetAddress *to_addrs, *cc_addrs; + const GSList *accounts = NULL; + EMsgComposer *composer; + + g_return_val_if_fail (message != NULL, NULL); + + accounts = mail_config_get_accounts (); + to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + + account = guess_me (to_addrs, cc_addrs, accounts); + + if (!account) { + const char *source; + + source = camel_mime_message_get_source (message); + account = mail_config_get_account_by_source_url (source); + } + + if (!account) + account = mail_config_get_default_account (); + + composer = e_msg_composer_new_redirect (message, account->name); + if (composer) { + gtk_signal_connect (GTK_OBJECT (composer), "send", + GTK_SIGNAL_FUNC (composer_send_cb), NULL); + gtk_signal_connect (GTK_OBJECT (composer), "postpone", + GTK_SIGNAL_FUNC (composer_postpone_cb), NULL); + gtk_signal_connect (GTK_OBJECT (composer), "save-draft", + GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL); + } else { + g_warning ("Could not create composer"); + } + + return composer; +} + +static void +do_redirect (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data) +{ + EMsgComposer *composer; + + if (!message) + return; + + composer = redirect_get_composer (message); + if (composer) { + CamelDataWrapper *wrapper; + + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message)); + if (CAMEL_IS_MULTIPART (wrapper)) + e_msg_composer_add_message_attachments (composer, message, FALSE); + + gtk_widget_show (GTK_WIDGET (composer)); + e_msg_composer_unset_changed (composer); + } +} + +void +redirect (GtkWidget *widget, gpointer user_data) +{ + FolderBrowser *fb = (FolderBrowser *) user_data; + + if (FOLDER_BROWSER_IS_DESTROYED (fb)) + return; + + if (!check_send_configuration (fb)) + return; + + if (fb->mail_display && fb->mail_display->current_message) { + do_redirect (fb->folder, NULL, + fb->mail_display->current_message, + NULL); + } else { + mail_get_message (fb->folder, fb->message_list->cursor_uid, + do_redirect, NULL, mail_thread_new); + } +} + static void transfer_msg_done (gboolean ok, void *data) { |