aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format-quote.c17
-rw-r--r--em-format/em-format.c24
2 files changed, 28 insertions, 13 deletions
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index bdb632b252..e2eb9d382b 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -530,9 +530,8 @@ emfq_format_message (EMFormat *emf,
cancellable, NULL);
}
-/* Decodes inline encoded parts of 'part'. The returned pointer, if not NULL, should
- be unreffed with g_object_unref().
-*/
+/* Decodes inline encoded parts of 'part'. The returned pointer,
+ * if not NULL, should be unreffed with g_object_unref(). */
static CamelMimePart *
decode_inline_parts (CamelMimePart *part, GCancellable *cancellable)
{
@@ -547,13 +546,16 @@ decode_inline_parts (CamelMimePart *part, GCancellable *cancellable)
filtered_stream = camel_stream_filter_new (null);
g_object_unref (null);
- inline_filter = em_inline_filter_new (camel_mime_part_get_encoding (part), camel_mime_part_get_content_type (part));
+ inline_filter = em_inline_filter_new (
+ camel_mime_part_get_encoding (part),
+ camel_mime_part_get_content_type (part));
camel_stream_filter_add (
CAMEL_STREAM_FILTER (filtered_stream),
CAMEL_MIME_FILTER (inline_filter));
camel_data_wrapper_decode_to_stream_sync (
- camel_medium_get_content (CAMEL_MEDIUM (part)), (CamelStream *)filtered_stream, cancellable, NULL);
- camel_stream_close ((CamelStream *)filtered_stream, cancellable, NULL);
+ camel_medium_get_content (CAMEL_MEDIUM (part)),
+ filtered_stream, cancellable, NULL);
+ camel_stream_close (filtered_stream, cancellable, NULL);
g_object_unref (filtered_stream);
if (!em_inline_filter_found_any (inline_filter)) {
@@ -567,7 +569,8 @@ decode_inline_parts (CamelMimePart *part, GCancellable *cancellable)
if (mp) {
part = camel_mime_part_new ();
- camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp));
+ camel_medium_set_content (
+ CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp));
g_object_unref (mp);
} else {
g_object_ref (part);
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 43c38c9179..cba7c765bc 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1490,19 +1490,31 @@ add_validity_found (EMFormat *emf,
/* ********************************************************************** */
static void
-preserve_charset_in_content_type (CamelMimePart *ipart, CamelMimePart *opart)
+preserve_charset_in_content_type (CamelMimePart *ipart,
+ CamelMimePart *opart)
{
- CamelContentType *ict;
+ CamelDataWrapper *data_wrapper;
+ CamelContentType *content_type;
+ const gchar *charset;
g_return_if_fail (ipart != NULL);
g_return_if_fail (opart != NULL);
- ict = camel_data_wrapper_get_mime_type_field (camel_medium_get_content (CAMEL_MEDIUM (ipart)));
- if (!ict || !camel_content_type_param (ict, "charset") || !*camel_content_type_param (ict, "charset"))
+ data_wrapper = camel_medium_get_content (CAMEL_MEDIUM (ipart));
+ content_type = camel_data_wrapper_get_mime_type_field (data_wrapper);
+
+ if (content_type == NULL)
+ return;
+
+ charset = camel_content_type_param (content_type, "charset");
+
+ if (charset == NULL || *charset == '\0')
return;
- camel_content_type_set_param (camel_data_wrapper_get_mime_type_field (camel_medium_get_content (CAMEL_MEDIUM (opart))),
- "charset", camel_content_type_param (ict, "charset"));
+ data_wrapper = camel_medium_get_content (CAMEL_MEDIUM (opart));
+ content_type = camel_data_wrapper_get_mime_type_field (data_wrapper);
+
+ camel_content_type_set_param (content_type, "charset", charset);
}
#ifdef ENABLE_SMIME