From a6f0914f29a46e353a17e36d0cb4f85424f58f3f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 3 Jul 2003 18:36:51 +0000 Subject: Strip the signature from the body text. Fixes bug #45523. While we're 2003-07-02 Jeffrey Stedfast * mail-tools.c (mail_tool_forward_message): Strip the signature from the body text. Fixes bug #45523. While we're here, also fix the code to quote exactly the same way as the mail_tool_quote_message() function. (mail_tool_quote_message): The last arg should not be 'want_plain', because that arg is for whether or not the body should be quoted. * folder-browser.c (message_list_drag_data_get): Apply a From-filter when dragging as a test/uri-list and message/rfc822. Fixes bug #45617. Also free the uids ptrarray for the text/uri-list case. svn path=/trunk/; revision=21739 --- mail/mail-tools.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'mail/mail-tools.c') diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 846d0d9dd7..758a4b512b 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -372,7 +372,7 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...) * am sure --Larry */ want_plain = FALSE; - text = mail_get_message_body (contents, want_plain, want_plain); + text = mail_get_message_body (contents, want_plain, FALSE); /* Set the quoted reply text. */ if (text) { @@ -427,19 +427,51 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...) gchar * mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted) { - char *title, *body, *ret; - gboolean send_html; GConfClient *gconf; + char *text; gconf = mail_config_get_gconf_client (); - send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL); - body = mail_get_message_body (CAMEL_DATA_WRAPPER (message), !send_html, quoted); - title = _("Forwarded Message"); - ret = g_strdup_printf ("-----%s-----
%s", title, body ? body : ""); - g_free (body); + text = mail_get_message_body (CAMEL_DATA_WRAPPER (message), FALSE, FALSE); - return ret; + if (text != NULL) { + char *sig, *p, *ret_text; + + /* FIXME: this code should be merged with the quote_message() code above somehow... */ + + /* look for the signature and strip it off */ + sig = text; + while ((p = strstr (sig, "\n-- \n"))) + sig = p + 1; + + if (sig != text) + *sig = '\0'; + + if (quoted) { + char *colour; + + colour = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL); + + ret_text = g_strdup_printf ("-----%s-----
" + "" + "\n%s%s%s" + "", + _("Forwarded Message"), + colour ? colour : "#737373", + "
", text, + "
"); + + g_free (colour); + } else { + ret_text = g_strdup_printf ("-----%s-----
%s", _("Forwarded Message"), text ? text : ""); + } + + g_free (text); + + return ret_text; + } + + return NULL; } -- cgit v1.2.3