aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-03-09 08:43:35 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-03-09 08:43:35 +0800
commit97a894dc7d40ebd32073c421a68caf582a1ba770 (patch)
tree81d790ea58aca2c24504379ce917e3fd59b4bd47 /mail/mail-callbacks.c
parentbc6cd6b9b6edb20bdf96a4e1f907639ec83e3e93 (diff)
downloadgsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar.gz
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar.bz2
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar.lz
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar.xz
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.tar.zst
gsoc2013-evolution-97a894dc7d40ebd32073c421a68caf582a1ba770.zip
Set the Forward->Quoted callback. Also set the forward->Attachment
2001-03-08 Jeffrey Stedfast <fejj@ximian.com> * folder-browser-factory.c: Set the Forward->Quoted callback. Also set the forward->Attachment callback. * mail-view.c (view_forward_msg): Specify FORWARD_ATTACHED. * mail-callbacks.c (forward_attached): Don't call forward_messages() anymore...never really needed to. Just handle it directly. (forward_inlined): Specify FORWARD_INLINE as the flag argument. (forward_quoted): New function sorta like forward_inlined except this forwards the message quoted. * mail-tools.c (mail_tool_forward_message): New function to prepare a message to be forwarded. svn path=/trunk/; revision=8611
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c94
1 files changed, 68 insertions, 26 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index b4356d05e5..36213a2c8a 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -722,54 +722,80 @@ forward_get_composer (const char *subject)
} else {
g_warning("Could not create composer");
}
-
+
return composer;
}
static void
-do_forward_inline(CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+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_forward_message (message);
+
+ if (text) {
+ EMsgComposer *composer = forward_get_composer (subject);
+ if (composer) {
+ e_msg_composer_set_body_text (composer, text);
+ gtk_widget_show (GTK_WIDGET (composer));
+ e_msg_composer_unset_changed (composer);
+ }
+ g_free (text);
+ }
+
+ g_free (subject);
+ }
+}
+static void
+do_forward_quoted (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+{
+ char *subject;
+ char *text;
+
if (message) {
- subject = mail_tool_generate_forward_subject(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);
+ EMsgComposer *composer = forward_get_composer (subject);
if (composer) {
- e_msg_composer_set_body_text(composer, text);
- gtk_widget_show(GTK_WIDGET(composer));
- e_msg_composer_unset_changed(composer);
+ e_msg_composer_set_body_text (composer, text);
+ gtk_widget_show (GTK_WIDGET (composer));
+ e_msg_composer_unset_changed (composer);
}
- g_free(text);
+ g_free (text);
}
-
- g_free(subject);
+
+ g_free (subject);
}
}
static void
-do_forward_attach(CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
+do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
{
if (part) {
- EMsgComposer *composer = forward_get_composer(subject);
+ EMsgComposer *composer = forward_get_composer (subject);
if (composer) {
- e_msg_composer_attach(composer, part);
- gtk_widget_show(GTK_WIDGET(composer));
- e_msg_composer_unset_changed(composer);
+ e_msg_composer_attach (composer, part);
+ gtk_widget_show (GTK_WIDGET (composer));
+ e_msg_composer_unset_changed (composer);
}
}
}
void
-forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean doinline)
+forward_messages (CamelFolder *folder, GPtrArray *uids, int flags)
{
- if (doinline && uids->len == 1) {
- mail_get_message(folder, uids->pdata[0], do_forward_inline, NULL, mail_thread_new);
+ if (flags == FORWARD_INLINE && uids->len == 1) {
+ mail_get_message (folder, uids->pdata[0], do_forward_inline, NULL, mail_thread_new);
+ } else if (flags == FORWARD_QUOTED && uids->len == 1) {
+ mail_get_message (folder, uids->pdata[0], do_forward_quoted, NULL, mail_thread_new);
} else {
- mail_build_attachment(folder, uids, do_forward_attach, NULL);
+ mail_build_attachment (folder, uids, do_forward_attach, NULL);
}
}
@@ -784,7 +810,23 @@ forward_inlined (GtkWidget *widget, gpointer user_data)
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);
+ forward_messages (fb->message_list->folder, uids, FORWARD_INLINE);
+ g_free (uids->pdata[0]);
+ g_ptr_array_free (uids, TRUE);
+}
+
+void
+forward_quoted (GtkWidget *widget, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ GPtrArray *uids;
+
+ 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, FORWARD_QUOTED);
g_free (uids->pdata[0]);
g_ptr_array_free (uids, TRUE);
}
@@ -794,13 +836,13 @@ forward_attached (GtkWidget *widget, gpointer user_data)
{
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);
+
+ 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);
}
static void