aboutsummaryrefslogtreecommitdiff
path: root/notmuch-reply.c
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2011-05-25 18:01:10 -0700
committerCarl Worth <cworth@cworth.org>2011-05-27 16:18:57 -0700
commit03ac922c4b4b542658a1c20e152df0ed63299c81 (patch)
tree2647d4f86cf1144c757c3c77e425f438eaf14e93 /notmuch-reply.c
parenta0ebd5c5e47fd6a5effaa81a4ea39f2d16b709d1 (diff)
Simplify reply_part function to eliminate redundant code paths.
This is the same logic but with less code.
Diffstat (limited to 'notmuch-reply.c')
-rw-r--r--notmuch-reply.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index ab15650..5d72b1f 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -88,31 +88,8 @@ static void
reply_part (GMimeObject *part,
unused (int *part_count))
{
- GMimeContentDisposition *disposition;
- GMimeContentType *content_type;
-
- disposition = g_mime_object_get_content_disposition (part);
- if (disposition &&
- strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
- {
- const char *filename = g_mime_part_get_filename (GMIME_PART (part));
- content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
-
- if (g_mime_content_type_is_type (content_type, "text", "*") &&
- !g_mime_content_type_is_type (content_type, "text", "html"))
- {
- reply_part_content (part);
- }
- else
- {
- printf ("Attachment: %s (%s)\n", filename,
- g_mime_content_type_to_string (content_type));
- }
-
- return;
- }
-
- content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
+ GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
+ GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);
if (g_mime_content_type_is_type (content_type, "text", "*") &&
!g_mime_content_type_is_type (content_type, "text", "html"))
@@ -121,8 +98,18 @@ reply_part (GMimeObject *part,
}
else
{
- printf ("Non-text part: %s\n",
- g_mime_content_type_to_string (content_type));
+ if (disposition &&
+ strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+ {
+ const char *filename = g_mime_part_get_filename (GMIME_PART (part));
+ printf ("Attachment: %s (%s)\n", filename,
+ g_mime_content_type_to_string (content_type));
+ }
+ else
+ {
+ printf ("Non-text part: %s\n",
+ g_mime_content_type_to_string (content_type));
+ }
}
}