From 1b595a7e2f7a49c46784868fc9c23f0ffe11b5ac Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 30 Jul 2001 21:28:33 +0000 Subject: When writing out a CamelException to the HTML stream, be sure to translate 2001-07-30 Jeffrey Stedfast * mail-format.c (decode_pgp): When writing out a CamelException to the HTML stream, be sure to translate it first. (handle_message_external_body): Convert to UTF8 here too - I know this function is basically a dead end right now but eventually we will want to do something. I mostly did this because param values are UTF8 encoded so we should avoid mixing and matching UTF with non UTF8. (format_mime_part): Avoid writing non-UTF8 to the HTML stream. * mail-tools.c (mail_tool_make_message_attachment): Convert translated strings to UTF8 here too. (mail_tool_forward_message): Here too. 2001-07-23 Zbigniew Chyla * mail-format.c (attachment_header, write_address, decode_pgp, mail_write_authenticity): Convert translated strings to UTF8 before calling mail_html_write. I modified the patch slightly and cleaned up bits of code around it as well. For example, we probably want to avoid having HTML tags in the strings to be translated. -- fejj svn path=/trunk/; revision=11490 --- mail/mail-tools.c | 65 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'mail/mail-tools.c') diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 624afa324d..92b9768137 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -1,6 +1,4 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-ops.c: callbacks for the mail toolbar/menus */ - /* * Authors: * Dan Winship @@ -33,6 +31,7 @@ #include #include #include +#include #include "camel/camel.h" #include "camel/camel-vee-folder.h" #include "mail-vfolder.h" @@ -160,48 +159,45 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex) int tmpfd; #endif g_return_val_if_fail (strncmp (source_url, "mbox:", 5) == 0, NULL); - + /* Set up our destination. */ - dest_path = mail_tool_get_local_movemail_path(); - + /* Create a new movemail mailbox file of 0 size */ - + #ifndef MOVEMAIL_PATH tmpfd = open (dest_path, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); - + if (tmpfd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't create temporary " - "mbox `%s': %s"), dest_path, g_strerror (errno)); + _("Couldn't create temporary mbox `%s': %s"), + dest_path, g_strerror (errno)); g_free (dest_path); return NULL; } - + close (tmpfd); #endif - + /* Skip over "mbox:" plus host part (if any) of url. */ - source = source_url + 5; if (!strncmp (source, "//", 2)) source = strchr (source + 2, '/'); - - + /* Movemail from source (source_url) to dest_path */ camel_movemail (source, dest_path, ex); - + if (stat (dest_path, &sb) < 0 || sb.st_size == 0) { unlink (dest_path); /* Clean up the movemail.foo file. */ g_free (dest_path); return NULL; } - + if (camel_exception_is_set (ex)) { g_free (dest_path); return NULL; } - + return dest_path; } @@ -225,7 +221,7 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) fwd_subj = g_strdup_printf ("[Fwd: %s]", fromstr); g_free (fromstr); } else - fwd_subj = g_strdup (_("[Fwd: No Subject]")); + fwd_subj = g_strdup ("[Fwd: No Subject]"); } return fwd_subj; @@ -236,15 +232,18 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) { CamelMimePart *part; const char *subject; - gchar *desc; + char *desc; subject = camel_mime_message_get_subject (message); - if (subject) - desc = g_strdup_printf (_("Forwarded message - %s"), subject); - else - desc = g_strdup (_("Forwarded message (no subject)")); - - /* FIXME: shouldn't we utf-8ify the description? */ + if (subject) { + char *fmt; + + fmt = e_utf8_from_locale_string (_("Forwarded message - %s")); + desc = g_strdup_printf (fmt, subject); + g_free (fmt); + } else { + desc = e_utf8_from_locale_string (_("Forwarded message")); + } part = camel_mime_part_new (); camel_mime_part_set_disposition (part, "inline"); @@ -413,7 +412,7 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...) } g_free (text); - printf ("ret: %s\n", ret_text); + return ret_text; } @@ -442,6 +441,7 @@ mail_tool_forward_message (CamelMimeMessage *message) gchar *ret_text, *credits = NULL; const CamelInternetAddress *cia; char *buf, *from, *to, *subject; + char *title; /* create credits */ cia = camel_mime_message_get_from (message); @@ -466,11 +466,14 @@ mail_tool_forward_message (CamelMimeMessage *message) else subject = ""; - credits = g_strdup_printf (_("-----Forwarded Message-----
" - "From: %s
" - "To: %s
" - "Subject: %s
"), - from ? from : "", to ? to : "", subject); + title = e_utf8_from_locale_string (_("Forwarded Message")); + credits = g_strdup_printf ("-----%s-----
" + "From: %s
" + "To: %s
" + "Subject: %s
", + title, from ? from : "", + to ? to : "", subject); + g_free (title); g_free (from); g_free (to); -- cgit