diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-03-09 08:43:35 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-03-09 08:43:35 +0800 |
commit | 97a894dc7d40ebd32073c421a68caf582a1ba770 (patch) | |
tree | 81d790ea58aca2c24504379ce917e3fd59b4bd47 /mail/mail-tools.c | |
parent | bc6cd6b9b6edb20bdf96a4e1f907639ec83e3e93 (diff) | |
download | gsoc2013-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-tools.c')
-rw-r--r-- | mail/mail-tools.c | 69 |
1 files changed, 63 insertions, 6 deletions
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-----<br>" + "<b>From:</b> %s<br>" + "<b>To:</b> %s<br>" + "<b>Subject:</b> %s<br>"), + 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<br>%s\n", credits, text); + + g_free (credits); + g_free (text); + + return ret_text; + } + + return NULL; +} |