aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-26 00:33:44 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-26 00:33:44 +0800
commit0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417 (patch)
treefcc5b5aa7752f750e708645f0ac2d9ac8c72adf0
parent661e18ae52310d3489f3a672e1b912fc5b93d528 (diff)
downloadgsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar.gz
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar.bz2
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar.lz
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar.xz
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.tar.zst
gsoc2013-evolution-0fbf9cd43f4198e6c6103dbf00ad2cd76dca8417.zip
Initialize `me' to NULL. (forward_attached): If we are only forwarding a
2001-07-25 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (mail_generate_reply): Initialize `me' to NULL. (forward_attached): If we are only forwarding a single message, pass the message along as the callback data, else pass NULL. (do_forward_attach): Updated for changes to forward_get_composer(). (do_forward_non_attached): Same. (forward_get_composer): Try to guess which account to forward the message from if the message passed in is non-NULL. svn path=/trunk/; revision=11401
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-callbacks.c49
2 files changed, 44 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a5493807df..26e9b7e043 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,6 +1,13 @@
2001-07-25 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (mail_generate_reply): Initialize `me' to NULL.
+ (forward_attached): If we are only forwarding a single message,
+ pass the message along as the callback data, else pass NULL.
+ (do_forward_attach): Updated for changes to
+ forward_get_composer().
+ (do_forward_non_attached): Same.
+ (forward_get_composer): Try to guess which account to forward the
+ message from if the message passed in is non-NULL.
2001-07-24 Peter Williams <peterw@ximian.com>
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 1df5939c37..51a9f16b40 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -858,12 +858,34 @@ enumerate_msg (MessageList *ml, const char *uid, gpointer data)
static EMsgComposer *
-forward_get_composer (const char *subject)
+forward_get_composer (CamelMimeMessage *message, const char *subject)
{
- const MailConfigAccount *account;
+ const CamelInternetAddress *to_addrs, *cc_addrs;
+ const MailConfigAccount *account = NULL;
+ const GSList *accounts = NULL;
EMsgComposer *composer;
- account = mail_config_get_default_account ();
+ if (message) {
+ const CamelInternetAddress *to_addrs, *cc_addrs;
+ const GSList *accounts = 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_with_sig_file ();
if (composer) {
gtk_signal_connect (GTK_OBJECT (composer), "send",
@@ -872,7 +894,7 @@ forward_get_composer (const char *subject)
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
e_msg_composer_set_headers (composer, account->name, NULL, NULL, NULL, subject);
} else {
- g_warning("Could not create composer");
+ g_warning ("Could not create composer");
}
return composer;
@@ -886,15 +908,15 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
if (!message)
return;
-
+
subject = mail_tool_generate_forward_subject (message);
if (GPOINTER_TO_INT (data) == MAIL_CONFIG_FORWARD_INLINE)
text = mail_tool_forward_message (message);
else
text = mail_tool_quote_message (message, _("Forwarded message:\n"));
-
+
if (text) {
- EMsgComposer *composer = forward_get_composer (subject);
+ EMsgComposer *composer = forward_get_composer (message, subject);
if (composer) {
e_msg_composer_set_body_text (composer, text);
gtk_widget_show (GTK_WIDGET (composer));
@@ -902,7 +924,7 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
}
g_free (text);
}
-
+
g_free (subject);
}
@@ -913,7 +935,7 @@ forward_message (FolderBrowser *fb, MailConfigForwardStyle style)
return;
if (!check_send_configuration (fb))
return;
-
+
mail_get_message (fb->folder, fb->message_list->cursor_uid,
do_forward_non_attached, GINT_TO_POINTER (style),
mail_thread_new);
@@ -934,8 +956,10 @@ forward_quoted (GtkWidget *widget, gpointer user_data)
static void
do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
{
+ CamelMimeMessage *message = data;
+
if (part) {
- EMsgComposer *composer = forward_get_composer (subject);
+ EMsgComposer *composer = forward_get_composer (message, subject);
if (composer) {
e_msg_composer_attach (composer, part);
gtk_widget_show (GTK_WIDGET (composer));
@@ -947,15 +971,16 @@ do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part
void
forward_attached (GtkWidget *widget, gpointer user_data)
{
- GPtrArray *uids;
FolderBrowser *fb = (FolderBrowser *)user_data;
+ GPtrArray *uids;
if (!check_send_configuration (fb))
return;
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
- mail_build_attachment (fb->message_list->folder, uids, do_forward_attach, NULL);
+ mail_build_attachment (fb->message_list->folder, uids, do_forward_attach,
+ uids->len == 1 ? fb->mail_display->current_message : NULL);
}
void