aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2001-01-03 19:52:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-01-03 19:52:04 +0800
commitc37da1342398fdc4836baa89d0506a0950a10bb6 (patch)
tree58d0977e7b47884a3e0ed644f5ac777336bf9403 /mail/mail-callbacks.c
parent3df84a345e9cec9fded0e697b660e6c18c91f9d7 (diff)
downloadgsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.gz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.bz2
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.lz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.xz
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.tar.zst
gsoc2013-evolution-c37da1342398fdc4836baa89d0506a0950a10bb6.zip
Call mail-callbacks.c:forward_messages(), so the behaviour is the same as
2001-01-03 Not Zed <NotZed@HelixCode.com> * mail-view.c (view_forward_msg): Call mail-callbacks.c:forward_messages(), so the behaviour is the same as from the folder browser. * mail-callbacks.c (forward_messages): New function to forward messages, attached or not. (forward_inlined): Changed to use new forward-messages implementation. (forward_attached): Likewise. (do_forward_attach): Callback for forwarding as attachment, once we have built it. (do_forward_inline): Likewise, for inline, once we have retrieved the message. (forward_message): Removed. * mail-ops.c (mail_build_attachment): New function to build an attachment of messages. (mail_do_attach_message): Removed, functionality superceeded by above. (mail_do_forward_message): Removed. Likewise. (mail_create_folder): Started work on an alternative implementation of create_folder, but not sure about it yet. * mail-tools.c (mail_tool_generate_forward_subject): Remove locking. (mail_tool_make_message_attachment): Free the description when done. svn path=/trunk/; revision=7232
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c116
1 files changed, 78 insertions, 38 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 736bba530e..a565da9f97 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -477,58 +477,98 @@ enumerate_msg (MessageList *ml, const char *uid, gpointer data)
g_ptr_array_add ((GPtrArray *) data, g_strdup (uid));
}
-static void
-forward_message (FolderBrowser *fb, gboolean attach)
+
+static EMsgComposer *forward_get_composer(const char *subject)
{
EMsgComposer *composer;
- CamelMimeMessage *cursor_msg;
MailConfigIdentity *id;
- GPtrArray *uids;
- gchar *sig_file = NULL;
- gboolean send_html;
-
- cursor_msg = fb->mail_display->current_message;
- g_return_if_fail (cursor_msg != NULL);
-
- if (!check_send_configuration (fb))
- return;
-
+
id = mail_config_get_default_identity ();
- send_html = mail_config_send_html ();
-
- if (id)
- sig_file = id->sig;
-
- composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
- if (!composer)
- return;
-
- uids = g_ptr_array_new ();
- if (attach)
- message_list_foreach (fb->message_list, enumerate_msg, uids);
- else
- g_ptr_array_add (uids, g_strdup (fb->message_list->cursor_uid));
-
- 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);
-
- mail_do_forward_message (cursor_msg,
- fb->message_list->folder,
- uids, composer, attach);
+ composer = e_msg_composer_new_with_sig_file(id?id->sig:NULL, mail_config_send_html());
+ 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);
+ e_msg_composer_set_headers(composer, NULL, NULL, NULL, subject);
+ } else {
+ g_warning("Could not create composer");
+ }
+
+ return composer;
+}
+
+static void
+do_forward_inline(CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+{
+ char *subject;
+ char *text;
+
+ if (message) {
+ subject = mail_tool_generate_forward_subject(message);
+ text = mail_tool_quote_message (message, _("Forwarded message:\n"));
+
+ if (text) {
+ EMsgComposer *composer = forward_get_composer(subject);
+ if (composer) {
+ e_msg_composer_set_body_text(composer, text);
+ gtk_widget_show((GtkWidget *)composer);
+ }
+ g_free(text);
+ }
+
+ g_free(subject);
+ }
+}
+
+static void
+do_forward_attach(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
+{
+ if (part) {
+ EMsgComposer *composer = forward_get_composer(subject);
+ if (composer) {
+ e_msg_composer_attach(composer, part);
+ gtk_widget_show((GtkWidget *)composer);
+ }
+ }
+}
+
+void
+forward_messages(CamelFolder *folder, GPtrArray *uids, int doinline)
+{
+ if (doinline && uids->len == 1) {
+ mail_get_message(folder, uids->pdata[0], do_forward_inline, NULL, mail_thread_new);
+ } else {
+ mail_build_attachment(folder, uids, do_forward_attach, NULL);
+ }
}
void
forward_inlined (GtkWidget *widget, gpointer user_data)
{
- forward_message (FOLDER_BROWSER (user_data), FALSE);
+ GPtrArray *uids;
+ FolderBrowser *fb = (FolderBrowser *)user_data;
+
+ if (!check_send_configuration (fb))
+ return;
+
+ uids = g_ptr_array_new();
+ g_ptr_array_add(uids, g_strdup (fb->message_list->cursor_uid));
+ forward_messages(fb->message_list->folder, uids, TRUE);
}
void
forward_attached (GtkWidget *widget, gpointer user_data)
{
- forward_message (FOLDER_BROWSER (user_data), TRUE);
+ GPtrArray *uids;
+ FolderBrowser *fb = (FolderBrowser *)user_data;
+
+ if (!check_send_configuration (fb))
+ return;
+
+ uids = g_ptr_array_new();
+ message_list_foreach(fb->message_list, enumerate_msg, uids);
+ forward_messages(fb->message_list->folder, uids, FALSE);
}
static void