aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-08 05:30:58 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-08 05:30:58 +0800
commitaecfa56f0211555716c0b984937132f447b8f47b (patch)
treea21807590f7085d7f0ff5a4bc8ab91964a92f821
parent3e65ef81be84cb22e5619372e8aea3ab09ca3ac5 (diff)
downloadgsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar.gz
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar.bz2
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar.lz
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar.xz
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.tar.zst
gsoc2013-evolution-aecfa56f0211555716c0b984937132f447b8f47b.zip
Give the full path of the wax-seal icons. (try_inline_pgp_sig): Convert
2001-09-07 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (mail_write_authenticity): Give the full path of the wax-seal icons. (try_inline_pgp_sig): Convert the charset from UTF-8 to whatever charset it should be. Now takes a CamelMimePart argument as well. (try_uudecoding): Now takes a part argument as well. (try_inline_pgp): Here too. (try_binhex): And finally here. (handle_text_plain): Pass along the mime part to the try_* functions. svn path=/trunk/; revision=12688
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-format.c63
2 files changed, 48 insertions, 22 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e909d004d3..95a5adc284 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -2,6 +2,13 @@
* mail-format.c (mail_write_authenticity): Give the full path of
the wax-seal icons.
+ (try_inline_pgp_sig): Convert the charset from UTF-8 to whatever
+ charset it should be. Now takes a CamelMimePart argument as well.
+ (try_uudecoding): Now takes a part argument as well.
+ (try_inline_pgp): Here too.
+ (try_binhex): And finally here.
+ (handle_text_plain): Pass along the mime part to the try_*
+ functions.
2001-09-06 Chris Toshok <toshok@ximian.com>
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 03c7df0157..925fdeea65 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -50,10 +50,10 @@
static char *get_data_wrapper_text (CamelDataWrapper *data);
-static char *try_inline_pgp (char *start, MailDisplay *md);
-static char *try_inline_pgp_sig (char *start, MailDisplay *md);
-static char *try_uudecoding (char *start, MailDisplay *md);
-static char *try_inline_binhex (char *start, MailDisplay *md);
+static char *try_inline_pgp (char *start, CamelMimePart *part, MailDisplay *md);
+static char *try_inline_pgp_sig (char *start, CamelMimePart *part, MailDisplay *md);
+static char *try_uudecoding (char *start, CamelMimePart *part, MailDisplay *md);
+static char *try_inline_binhex (char *start, CamelMimePart *part, MailDisplay *md);
static void decode_pgp (CamelStream *ciphertext, CamelStream *plaintext, MailDisplay *md);
@@ -1043,7 +1043,7 @@ get_data_wrapper_text (CamelDataWrapper *wrapper)
struct {
char *start;
- char * (*handler) (char *start, MailDisplay *md);
+ char * (*handler) (char *start, CamelMimePart *part, MailDisplay *md);
} text_specials[] = {
{ "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp },
{ "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig },
@@ -1101,7 +1101,8 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
/* the %.*s thing just grabs upto start-p chars; go read ANSI C */
mail_text_write (md->html, md->stream, "%.*s", start-p, p);
}
- p = text_specials[i].handler (start, md);
+
+ p = text_specials[i].handler (start, part, md);
if (p == start) {
/* Oops. That failed. Output this line normally and
* skip over it.
@@ -1342,7 +1343,7 @@ decode_pgp (CamelStream *ciphertext, CamelStream *plaintext, MailDisplay *md)
}
static char *
-try_inline_pgp (char *start, MailDisplay *md)
+try_inline_pgp (char *start, CamelMimePart *part, MailDisplay *md)
{
CamelStream *ciphertext, *plaintext;
GByteArray *buffer;
@@ -1416,16 +1417,17 @@ mail_write_authenticity (MailDisplay *md, CamelCipherValidity *valid)
}
static char *
-try_inline_pgp_sig (char *start, MailDisplay *md)
+try_inline_pgp_sig (char *start, CamelMimePart *part, MailDisplay *md)
{
CamelCipherValidity *valid = NULL;
CamelPgpContext *context;
- char *end, *msg_start, *pgp_start;
+ char *msg_start, *pgp_start, *sig_start, *sig_end;
+ const char *charset;
- msg_start = strstr (start, "-----BEGIN PGP SIGNED MESSAGE-----");
- if (msg_start) {
+ pgp_start = strstr (start, "-----BEGIN PGP SIGNED MESSAGE-----");
+ if (pgp_start) {
/* skip over -----BEGIN PGP SIGNED MESSAGE----- */
- msg_start = strchr (msg_start, '\n');
+ msg_start = strchr (pgp_start, '\n');
if (!msg_start++)
return start;
@@ -1440,16 +1442,16 @@ try_inline_pgp_sig (char *start, MailDisplay *md)
}
/* find the beginning of the signature block */
- pgp_start = strstr (msg_start, "-----BEGIN PGP SIGNATURE-----");
- if (!pgp_start)
+ sig_start = strstr (msg_start, "-----BEGIN PGP SIGNATURE-----");
+ if (!sig_start)
return start;
/* find the end of the pgp signature block */
- end = strstr (pgp_start, "-----END PGP SIGNATURE-----");
- if (!end)
+ sig_end = strstr (sig_start, "-----END PGP SIGNATURE-----");
+ if (!sig_end)
return start;
- end += strlen ("-----END PGP SIGNATURE-----");
+ sig_end += strlen ("-----END PGP SIGNATURE-----") + 1;
mail_html_write (md->html, md->stream, "<hr>");
@@ -1458,13 +1460,30 @@ try_inline_pgp_sig (char *start, MailDisplay *md)
mail_config_get_remember_pgp_passphrase ());
if (context) {
+ CamelMimeFilterCharset *charset_filter;
+ CamelStreamFilter *filtered_stream;
CamelStream *ciphertext;
+ CamelContentType *type;
+ const char *charset;
CamelException *ex;
ex = camel_exception_new ();
ciphertext = camel_stream_mem_new ();
- camel_stream_write (ciphertext, start, end - start);
+
+ type = camel_mime_part_get_content_type (part);
+ charset = header_content_type_param (type, "charset");
+ if (!charset)
+ charset = mail_config_get_default_charset ();
+
+ charset_filter = camel_mime_filter_charset_new_convert ("utf-8", charset);
+ filtered_stream = camel_stream_filter_new_with_stream (ciphertext);
+ camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (charset_filter));
+
+ camel_stream_write (filtered_stream, pgp_start, sig_end - pgp_start);
+ camel_stream_flush (CAMEL_STREAM (filtered_stream));
+ camel_object_unref (CAMEL_OBJECT (filtered_stream));
+
camel_stream_reset (ciphertext);
valid = camel_pgp_verify (context, ciphertext, NULL, ex);
@@ -1474,7 +1493,7 @@ try_inline_pgp_sig (char *start, MailDisplay *md)
camel_exception_free (ex);
}
- mail_text_write (md->html, md->stream, "%.*s", pgp_start - msg_start, msg_start);
+ mail_text_write (md->html, md->stream, "%.*s", sig_start - msg_start, msg_start);
mail_write_authenticity (md, valid);
@@ -1482,11 +1501,11 @@ try_inline_pgp_sig (char *start, MailDisplay *md)
camel_cipher_validity_free (valid);
- return end;
+ return sig_end;
}
static char *
-try_uudecoding (char *start, MailDisplay *md)
+try_uudecoding (char *start, CamelMimePart *mime_part, MailDisplay *md)
{
int mode, len, state = 0;
char *filename, *estart, *p, *out, uulen = 0;
@@ -1531,7 +1550,7 @@ try_uudecoding (char *start, MailDisplay *md)
}
static char *
-try_inline_binhex (char *start, MailDisplay *md)
+try_inline_binhex (char *start, CamelMimePart *mime_part, MailDisplay *md)
{
char *p;
CamelMimePart *part;