From 97a894dc7d40ebd32073c421a68caf582a1ba770 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 9 Mar 2001 00:43:35 +0000 Subject: Set the Forward->Quoted callback. Also set the forward->Attachment 2001-03-08 Jeffrey Stedfast * 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 --- mail/mail-tools.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 6 deletions(-) (limited to 'mail/mail-tools.c') diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 0c623916ac..48a0bd94e8 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -167,12 +167,6 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex) return dest_path; } -void -mail_tool_set_uid_flags (CamelFolder *folder, const char *uid, guint32 mask, guint32 set) -{ - camel_folder_set_message_flags (folder, uid, mask, set); -} - char * mail_tool_generate_forward_subject (CamelMimeMessage *msg) { @@ -376,3 +370,66 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...) return NULL; } + +/** + * mail_tool_forward_message: + * @message: mime message to quote + * + * Returns an allocated buffer containing the forwarded message. + */ +gchar * +mail_tool_forward_message (CamelMimeMessage *message) +{ + CamelDataWrapper *contents; + gboolean want_plain, is_html; + gchar *text; + + want_plain = !mail_config_get_send_html (); + contents = camel_medium_get_content_object (CAMEL_MEDIUM (message)); + text = mail_get_message_body (contents, want_plain, &is_html); + + /* Set the quoted reply text. */ + if (text) { + gchar *ret_text, *credits = NULL; + const CamelInternetAddress *cia; + const char *subject; + char *buf, *from, *to; + + /* create credits */ + cia = camel_mime_message_get_from (message); + buf = camel_address_format (CAMEL_ADDRESS (cia)); + from = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); + g_free (buf); + + cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + buf = camel_address_format (CAMEL_ADDRESS (cia)); + to = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS); + g_free (buf); + + subject = camel_mime_message_get_subject (message); + + credits = g_strdup_printf (_("-----Forwarded Message-----
" + "From: %s
" + "To: %s
" + "Subject: %s
"), + from, to, subject); + g_free (from); + g_free (to); + + if (!is_html) { + /* Now convert that to HTML. */ + ret_text = e_text_to_html (text, E_TEXT_TO_HTML_PRE); + g_free (text); + text = ret_text; + } + + ret_text = g_strdup_printf ("%s
%s\n", credits, text); + + g_free (credits); + g_free (text); + + return ret_text; + } + + return NULL; +} -- cgit