aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2015-09-26 12:35:22 +0300
committerDavid Bremner <david@tethera.net>2015-11-19 07:47:29 -0400
commit1abc33833149f6c71850c1b6f4bdeca38c718023 (patch)
tree0c42dfb09f8f59a043958de3d2d3474873336fed
parent506b81679a883d2a96bcd17e7c826a3166bdf82e (diff)
cli: content disposition values are not case-sensitive
Per RFC 2183, the values for Content-Disposition values are not case-sensitive. While at it, use the gmime function for getting at the disposition string instead of referencing the field directly. This fixes attachment display and quoting in notmuch show and reply, respectively.
-rw-r--r--notmuch-reply.c3
-rw-r--r--notmuch-show.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 13571429..6df54fc9 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -80,7 +80,8 @@ format_part_reply (mime_node_t *node)
show_text_part_content (node->part, stream_stdout, NOTMUCH_SHOW_TEXT_PART_REPLY);
g_object_unref(stream_stdout);
} else if (disposition &&
- strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) {
+ strcasecmp (g_mime_content_disposition_get_disposition (disposition),
+ GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
printf ("Attachment: %s (%s)\n", filename,
g_mime_content_type_to_string (content_type));
diff --git a/notmuch-show.c b/notmuch-show.c
index 5a83c605..87e52bbc 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -456,7 +456,8 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;
if (disposition &&
- strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+ strcasecmp (g_mime_content_disposition_get_disposition (disposition),
+ GMIME_DISPOSITION_ATTACHMENT) == 0)
part_type = "attachment";
else
part_type = "part";