aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-01-30 05:06:01 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-01-30 05:06:01 +0800
commit865606984fb9d3c1a3e6af99ceea17fac7c18b07 (patch)
tree592520727af3a87a5e5baa15685a10f65d116f8d
parent85610de9fec51076b7ff834e22409a029d18a484 (diff)
downloadgsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar
gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.gz
gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.bz2
gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.lz
gsoc2013-evolution-865606984fb9d3c1a3e6af99ceea17fac7c18b07.tar.xz
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
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/folder-browser-ui.c4
-rw-r--r--mail/mail-callbacks.c83
-rw-r--r--mail/mail-callbacks.h2
-rw-r--r--mail/mail-ops.c40
-rw-r--r--mail/mail-session.c2
6 files changed, 143 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 41477f37d5..09552a220a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+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.
+
2002-01-29 Radek Doulik <rodo@ximian.com>
* mail-callbacks.c (do_mail_print): initialize line to 0 to make
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 0960bd1bc4..1fe15cdc2f 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -51,6 +51,7 @@ static BonoboUIVerb message_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached),
BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline),
BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted),
+ BONOBO_UI_UNSAFE_VERB ("MessageRedirect", redirect),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important),
@@ -549,6 +550,7 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
"MessageMarkAsImportant", "MessageMarkAsUnimportant",
"MessageOpen", "MessageSaveAs",
"MessageForward", "MessageForwardAttached",
+ "MessageRedirect",
"EditCut", "EditCopy", "EditPaste", "ViewHideSelected",
@@ -561,7 +563,7 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
static const char *multiple_disables[] = {
/* actions that work on exactly 1 message */
"MessageReplyAll", "MessageReplyList", "MessageReplySender", "MessageResend",
- "MessageForwardInline", "MessageForwardQuoted", "MessageSearch",
+ "MessageForwardInline", "MessageForwardQuoted", "MessageRedirect", "MessageSearch",
"PrintMessage", "PrintPreviewMessage",
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)
{
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 9a82884640..bd33a11ecf 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -54,6 +54,8 @@ void forward_quoted (GtkWidget *widget, gpointer user_data);
void forward_attached (GtkWidget *widget, gpointer user_data);
void forward (GtkWidget *widget, gpointer user_data);
+void redirect (GtkWidget *widget, gpointer user_data);
+
void reply_to_sender (GtkWidget *widget, gpointer user_data);
void reply_to_list (GtkWidget *widget, gpointer user_data);
void reply_to_all (GtkWidget *widget, gpointer user_data);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index fa43d361f3..4973c56dbc 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -426,19 +426,35 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation
extern CamelFolder *sent_folder;
+static char *normal_recipients[] = {
+ CAMEL_RECIPIENT_TYPE_TO,
+ CAMEL_RECIPIENT_TYPE_CC,
+ CAMEL_RECIPIENT_TYPE_BCC
+};
+
+static char *resent_recipients[] = {
+ CAMEL_RECIPIENT_TYPE_RESENT_TO,
+ CAMEL_RECIPIENT_TYPE_RESENT_CC,
+ CAMEL_RECIPIENT_TYPE_RESENT_BCC
+};
+
/* send 1 message to a specific transport */
static void
mail_send_message (CamelMimeMessage *message, const char *destination,
CamelFilterDriver *driver, CamelException *ex)
{
+ const CamelInternetAddress *iaddr;
+ CamelAddress *from, *recipients;
CamelMessageInfo *info;
CamelTransport *xport = NULL;
char *transport_url = NULL;
char *sent_folder_uri = NULL;
+ const char *resent_from;
CamelFolder *folder;
XEvolution *xev;
+ int i;
- camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer",
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer",
"Evolution/" VERSION SUB_VERSION " " VERSION_COMMENT);
camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);
@@ -471,7 +487,27 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
return;
}
- camel_transport_send (xport, CAMEL_MEDIUM (message), ex);
+ from = (CamelAddress *) camel_internet_address_new ();
+ resent_from = camel_medium_get_header (CAMEL_MEDIUM (message), "Resent-From");
+ if (resent_from) {
+ camel_address_decode (from, resent_from);
+ } else {
+ iaddr = camel_mime_message_get_from (message);
+ camel_address_copy (from, CAMEL_ADDRESS (iaddr));
+ }
+
+ recipients = (CamelAddress *) camel_internet_address_new ();
+ for (i = 0; i < 3; i++) {
+ const char *type;
+
+ type = resent_from ? resent_recipients[i] : normal_recipients[i];
+ iaddr = camel_mime_message_get_recipients (message, type);
+ camel_address_cat (recipients, CAMEL_ADDRESS (iaddr));
+ }
+
+ camel_transport_send_to (xport, CAMEL_MEDIUM (message), from, recipients, ex);
+ camel_object_unref (CAMEL_OBJECT (recipients));
+ camel_object_unref (CAMEL_OBJECT (from));
mail_tool_restore_xevolution_headers (message, xev);
mail_tool_destroy_xevolution (xev);
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 07d27d639e..20f72762cd 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -857,7 +857,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
camel_filter_driver_set_shell_exec_func (driver, mail_execute_shell_command, NULL);
camel_filter_driver_set_play_sound_func (driver, session_play_sound, NULL);
- camel_filter_driver_set_play_sound_func (driver, session_system_beep, NULL);
+ camel_filter_driver_set_system_beep_func (driver, session_system_beep, NULL);
fsearch = g_string_new ("");
faction = g_string_new ("");