--- /dev/null
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 183E9431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 08:59:56 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 5tq0XaJowOHB for <notmuch@notmuchmail.org>;\r
+ Mon, 20 May 2013 08:59:48 -0700 (PDT)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 5B0DE431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 08:59:48 -0700 (PDT)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+ by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id r4KFxdDv008958;\r
+ Mon, 20 May 2013 12:59:39 -0300\r
+Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+ ([156.34.82.78] helo=zancas.localnet)\r
+ by tesseract.cs.unb.ca with esmtpsa\r
+ (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1UeSUs-0007Yr-FR; Mon, 20 May 2013 12:59:39 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1UeSUk-00083W-Nt; Mon, 20 May 2013 12:59:30 -0300\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] devel: add dkg's printmimestructure script to notmuch devel\r
+ scripts\r
+Date: Mon, 20 May 2013 12:59:19 -0300\r
+Message-Id: <1369065559-30788-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.2.rc2\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Spam_bar: -\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 May 2013 15:59:56 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+I find this script pretty useful when figuring out who to blame for\r
+MIME rendering problems. It currently isn't very widely known, so it\r
+seems worth distributing with notmuch.\r
+---\r
+\r
+I did a small amount whitespace cleanup compared to version in dkg's git repo.\r
+\r
+ devel/printmimestructure | 54 ++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 54 insertions(+)\r
+ create mode 100755 devel/printmimestructure\r
+\r
+diff --git a/devel/printmimestructure b/devel/printmimestructure\r
+new file mode 100755\r
+index 0000000..b8084a9\r
+--- /dev/null\r
++++ b/devel/printmimestructure\r
+@@ -0,0 +1,54 @@\r
++#!/usr/bin/env python\r
++# -*- coding: utf-8 -*-\r
++\r
++# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
++# License: GPLv3+\r
++\r
++# Updates: git://lair.fifthhorseman.net/~dkg/printmimestructure\r
++\r
++# This script reads a MIME message from stdin and produces a treelike\r
++# representation on it stdout.\r
++\r
++# Example:\r
++#\r
++# 0 dkg@alice:~$ printmimestructure < 'Maildir/cur/1269025522.M338697P12023.monkey,S=6459,W=6963:2,Sa'\r
++# └┬╴multipart/signed 6546 bytes\r
++# ├─╴text/plain inline 895 bytes\r
++# └─╴application/pgp-signature inline [signature.asc] 836 bytes\r
++# 0 dkg@alice:~$\r
++\r
++\r
++# If you want to number the parts, i suggest piping the output through\r
++# something like "cat -n"\r
++\r
++import email\r
++import sys\r
++\r
++def test(z, prefix=''):\r
++ fname = '' if z.get_filename() is None else ' [' + z.get_filename() + ']'\r
++ cset = '' if z.get_charset() is None else ' (' + z.get_charset() + ')'\r
++ disp = z.get_params(None, header='Content-Disposition')\r
++ if (disp is None):\r
++ disposition = ''\r
++ else:\r
++ disposition = ''\r
++ for d in disp:\r
++ if d[0] in [ 'attachment', 'inline' ]:\r
++ disposition = ' ' + d[0]\r
++ if (z.is_multipart()):\r
++ print prefix + '┬╴' + z.get_content_type() + cset + disposition + fname, z.as_string().__len__().__str__() + ' bytes'\r
++ if prefix.endswith('└'):\r
++ prefix = prefix.rpartition('└')[0] + ' '\r
++ if prefix.endswith('├'):\r
++ prefix = prefix.rpartition('├')[0] + '│'\r
++ parts = z.get_payload()\r
++ i = 0\r
++ while (i < parts.__len__()-1):\r
++ test(parts[i], prefix + '├')\r
++ i += 1\r
++ test(parts[i], prefix + '└')\r
++ # FIXME: show epilogue?\r
++ else:\r
++ print prefix + '─╴'+ z.get_content_type() + cset + disposition + fname, z.get_payload().__len__().__str__(), 'bytes'\r
++\r
++test(email.message_from_file(sys.stdin), '└')\r
+-- \r
+1.8.2.rc2\r
+\r