Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B1587431FBC for ; Fri, 12 Feb 2010 07:04:00 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.062 X-Spam-Level: X-Spam-Status: No, score=-1.062 tagged_above=-999 required=5 tests=[AWL=-0.877, BAYES_40=-0.185] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L4-hcarvUYTK for ; Fri, 12 Feb 2010 07:03:59 -0800 (PST) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by olra.theworths.org (Postfix) with ESMTP id A8F3E431FAE for ; Fri, 12 Feb 2010 07:03:59 -0800 (PST) Received: by fg-out-1718.google.com with SMTP id e12so263064fga.2 for ; Fri, 12 Feb 2010 07:03:58 -0800 (PST) Received: by 10.86.239.1 with SMTP id m1mr2874615fgh.57.1265987038668; Fri, 12 Feb 2010 07:03:58 -0800 (PST) Received: from aw.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1]) by mx.google.com with ESMTPS id d4sm1172241fga.3.2010.02.12.07.03.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Feb 2010 07:03:57 -0800 (PST) Received: by aw.hh.sledj.net (Postfix, from userid 1000) id 62EB53A03A; Fri, 12 Feb 2010 15:03:39 +0000 (GMT) To: notmuch From: David Edmondson Date: Fri, 12 Feb 2010 15:03:39 +0000 Message-ID: <87zl3esdh0.fsf@aw.hh.sledj.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: [notmuch] [RFC] improved display of message/rfc822 parts X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2010 15:04:00 -0000 --=-=-= I seem to get a lot of forwarded message/rfc822 parts and the default formatting (which is to inline the contents of the included message) is very confusing. Attached is a patch which attempts to improve this. Given that I'm new to notmuch hacking, any comments would be appreciated. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-show-Make-message-rfc822-parts-explicit-in-show-outp.patch >From 7fd7ad00f4b8f8a2610eb15eeee98a1c0bb4351e Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Fri, 12 Feb 2010 15:01:06 +0000 Subject: [PATCH] show: Make message/rfc822 parts explicit in show output. show: Display header information for message/rfc822 parts. --- notmuch-show.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 376aacd..6f12560 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -97,6 +97,34 @@ show_part_content (GMimeObject *part) } static void +show_message_rfc822 (GMimeObject *part, int *part_count, + void (*show_part) (GMimeObject *part, int *part_count)) +{ + GMimeMessage *message; + const char *headers[] = { + "Subject", "From", "To", "Cc", "Bcc", "Date" + }; + const char *name, *value; + unsigned int i; + + *part_count = *part_count + 1; + + message = g_mime_message_part_get_message (GMIME_MESSAGE_PART (part)); + + printf ("\n"); + for (i = 0; i < ARRAY_SIZE (headers); i++) { + name = headers[i]; + value = g_mime_object_get_header (GMIME_OBJECT (message), name); + if (value) + printf ("%s: %s\n", name, value); + } + printf ("\n"); + + show_part (g_mime_message_get_mime_part (message), + part_count); +} + +static void show_part (GMimeObject *part, int *part_count) { GMimeContentDisposition *disposition; @@ -137,6 +165,10 @@ show_part (GMimeObject *part, int *part_count) { show_part_content (part); } + else if (g_mime_content_type_is_type (content_type, "message", "rfc822")) + { + show_message_rfc822 (part, part_count, show_part); + } else { printf ("Non-text part: %s\n", -- 1.6.6.1 --=-=-= dme. -- David Edmondson, http://dme.org --=-=-=--