From 27556a45c288a2d2bdbfd05e7ee95f4ae61398fe Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 4 Aug 2001 19:00:40 +0000 Subject: Add yet another special-case hack for application/pgp. 2001-08-04 Jeffrey Stedfast * mail-format.c (mail_part_is_inline): Add yet another special-case hack for application/pgp. svn path=/trunk/; revision=11652 --- mail/mail-format.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'mail/mail-format.c') diff --git a/mail/mail-format.c b/mail/mail-format.c index 7522b1d674..983565cdda 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -96,9 +96,11 @@ static gboolean handle_message_external_body (CamelMimePart *part, const char *mime_type, MailDisplay *md); +#ifdef APPLICATION_PGP_IS_NO_LONGER_SUPPORTED static gboolean handle_application_pgp (CamelMimePart *part, const char *mime_type, MailDisplay *md); +#ifdef /* APPLICATION_PGP_IS_NO_LONGER_SUPPORTED */ static gboolean handle_via_bonobo (CamelMimePart *part, const char *mime_type, @@ -346,12 +348,14 @@ setup_mime_tables (void) g_hash_table_insert (mime_function_table, "multipart/signed", handle_multipart_signed); +#ifdef APPLICATION_PGP_IS_NO_LONGER_SUPPORTED /* Some broken mailers, such as The Bat! send pgp * signed/encrypted messages with a content-type of * application/pgp which basically means it's a text/plain but * either signed or encrypted. */ g_hash_table_insert (mime_function_table, "application/pgp", handle_application_pgp); +#endif /* APPLICATION_PGP_IS_NO_LONGER_SUPPORTED */ /* RFC 2046 says unrecognized text subtypes can be treated * as text/plain (as long as you recognize the character set), @@ -483,11 +487,11 @@ is_anonymous (CamelMimePart *part, const char *mime_type) if (!g_strncasecmp (mime_type, "multipart/", 10) || !g_strncasecmp (mime_type, "message/", 8)) return TRUE; - + if (!g_strncasecmp (mime_type, "text/", 5) && !camel_mime_part_get_filename (part)) return TRUE; - + return FALSE; } @@ -504,25 +508,35 @@ mail_part_is_inline (CamelMimePart *part) CamelContentType *content_type; char *type; gboolean anon; - + /* If it has an explicit disposition, return that. */ disposition = camel_mime_part_get_disposition (part); if (disposition) return g_strcasecmp (disposition, "inline") == 0; - + /* Certain types should default to inline. FIXME: this should * be customizable. */ content_type = camel_mime_part_get_content_type (part); if (!header_content_type_is (content_type, "message", "*")) return TRUE; - + +#ifdef APPLICATION_PGP_IS_NO_LONGER_SUPPORTED + /* The Bat! and possibly a few other broken mailers send application/pgp + * parts instead of following rfc2015 because they SUCK!!! Since this part + * is really a text/plain part, we should show it inline. + */ + if (!header_content_type_is (content_type, "application", "pgp")) + return TRUE; +#endif /* APPLICATION_PGP_IS_NO_LONGER_SUPPORTED */ + /* Otherwise, display it inline if it's "anonymous", and * as an attachment otherwise. */ type = header_content_type_simple (content_type); anon = is_anonymous (part, type); g_free (type); + return anon; } @@ -1106,6 +1120,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type, return TRUE; } +#ifdef APPLICATION_PGP_IS_NO_LONGER_SUPPORTED /* This is a special-case hack from broken mailers such as The Bat! */ static gboolean handle_application_pgp (CamelMimePart *part, const char *mime_type, @@ -1160,6 +1175,7 @@ handle_application_pgp (CamelMimePart *part, const char *mime_type, return handle_text_plain (part, "text/plain", md); } +#endif /* APPLICATION_PGP_IS_NO_LONGER_SUPPORTED */ static gboolean handle_text_plain_flowed (char *buf, MailDisplay *md) -- cgit v1.2.3