From: Jameson Graef Rollins <jrollins@finestructure.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 01/11] Simplify reply_part function to eliminate redundant code paths.
Date: Wed, 25 May 2011 18:01:10 -0700 [thread overview]
Message-ID: <1306371680-19441-2-git-send-email-jrollins@finestructure.net> (raw)
In-Reply-To: <1306371680-19441-1-git-send-email-jrollins@finestructure.net>
This is the same logic but with less code.
---
notmuch-reply.c | 41 ++++++++++++++---------------------------
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));
+ }
}
}
--
1.7.4.4
next prev parent reply other threads:[~2011-05-26 1:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 1:01 New crypto patch series Jameson Graef Rollins
2011-05-26 1:01 ` Jameson Graef Rollins [this message]
2011-05-26 1:01 ` [PATCH 02/11] Integrate reply_part_content function into reply_part function Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 03/11] Use empty strings instead of NULL in format_reply structure Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 04/11] Break up format->part function into part_start and part_content functions Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 05/11] test: new test-lib function to test for equality between files Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 06/11] test: add notmuch_show_sanitize_all function that is a little more aggressive Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 07/11] test: add crypto tests for signature verification and decryption Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 08/11] Add signature verification of PGP/MIME-signed parts with --verify Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 09/11] Add decryption of PGP/MIME-encrypted parts with --decrypt Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 10/11] emacs: Add support for PGP/MIME verification/decryption Jameson Graef Rollins
2011-05-26 1:01 ` [PATCH 11/11] tag signed/encrypted during notmuch new Jameson Graef Rollins
2011-05-27 10:27 ` normalizing part numbering across PGP/MIME processing Jameson Graef Rollins
2011-05-27 10:27 ` [PATCH 1/4] Do not replace multipart/signed part with content part when doing verification Jameson Graef Rollins
2011-05-27 10:27 ` [PATCH 2/4] Render all parts of multipart/encrypted when decrypting Jameson Graef Rollins
2011-05-27 10:27 ` [PATCH 3/4] emacs: Do not attempt to render arbitrary application parts Jameson Graef Rollins
2011-05-27 10:27 ` [PATCH 4/4] emacs: Give mutlipart/{signed, encrypted} their own part handler Jameson Graef Rollins
2011-05-27 18:52 ` [PATCH] " Jameson Graef Rollins
2011-05-27 18:34 ` normalizing part numbering across PGP/MIME processing Daniel Kahn Gillmor
2011-05-28 0:53 ` Carl Worth
2011-05-28 21:31 ` Jameson Graef Rollins
2011-06-03 21:34 ` Carl Worth
2011-06-03 23:03 ` [PATCH] Always return the empty string if decryption tries to demand a password Daniel Kahn Gillmor
2011-06-03 23:15 ` Carl Worth
2011-06-03 23:37 ` Daniel Kahn Gillmor
2011-06-03 23:57 ` [PATCH] Use stock GMimeSession by default Daniel Kahn Gillmor
2011-06-03 23:57 ` Daniel Kahn Gillmor
2011-06-04 1:11 ` Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306371680-19441-2-git-send-email-jrollins@finestructure.net \
--to=jrollins@finestructure.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).