aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-31 05:28:33 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-31 05:28:33 +0800
commit1b595a7e2f7a49c46784868fc9c23f0ffe11b5ac (patch)
tree4b2a84174c3c36779b0e0e32df22c2d4f0be804c /mail/mail-tools.c
parentf88337e4df2809b9ca122686ed6fd0ce83ef8859 (diff)
downloadgsoc2013-evolution-1b595a7e2f7a49c46784868fc9c23f0ffe11b5ac.tar.gz
gsoc2013-evolution-1b595a7e2f7a49c46784868fc9c23f0ffe11b5ac.tar.zst
gsoc2013-evolution-1b595a7e2f7a49c46784868fc9c23f0ffe11b5ac.zip
When writing out a CamelException to the HTML stream, be sure to translate
2001-07-30 Jeffrey Stedfast <fejj@ximian.com> * 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 <cyba@gnome.pl> * 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
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c65
1 files changed, 34 insertions, 31 deletions
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 <danw@ximian.com>
@@ -33,6 +31,7 @@
#include <pthread.h>
#include <ctype.h>
#include <errno.h>
+#include <gal/widgets/e-unicode.h>
#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-----<br>"
- "<b>From:</b> %s<br>"
- "<b>To:</b> %s<br>"
- "<b>Subject:</b> %s<br>"),
- from ? from : "", to ? to : "", subject);
+ title = e_utf8_from_locale_string (_("Forwarded Message"));
+ credits = g_strdup_printf ("-----%s-----<br>"
+ "<b>From:</b> %s<br>"
+ "<b>To:</b> %s<br>"
+ "<b>Subject:</b> %s<br>",
+ title, from ? from : "",
+ to ? to : "", subject);
+ g_free (title);
g_free (from);
g_free (to);