1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 3F88F431FC0
\r
6 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 07:15:11 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id bIwPNoNox1pe for <notmuch@notmuchmail.org>;
\r
16 Tue, 21 May 2013 07:15:07 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id A2A92431FB6
\r
19 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 07:15:06 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 325D41002C3;
\r
22 Tue, 21 May 2013 17:15:04 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: david@tethera.net, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] devel: add dkg's printmimestructure script to notmuch
\r
27 In-Reply-To: <1369065559-30788-1-git-send-email-david@tethera.net>
\r
28 References: <1369065559-30788-1-git-send-email-david@tethera.net>
\r
29 User-Agent: Notmuch/0.15.2+99~g7e455bc (http://notmuchmail.org) Emacs/24.3.1
\r
30 (x86_64-unknown-linux-gnu)
\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
32 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
33 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
34 Date: Tue, 21 May 2013 17:15:03 +0300
\r
35 Message-ID: <m2y5b84dy0.fsf@guru.guru-group.fi>
\r
37 Content-Type: text/plain; charset=utf-8
\r
38 Content-Transfer-Encoding: quoted-printable
\r
39 Cc: David Bremner <bremner@debian.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Tue, 21 May 2013 14:15:11 -0000
\r
54 On Mon, May 20 2013, david@tethera.net wrote:
\r
56 > From: David Bremner <bremner@debian.org>
\r
58 > I find this script pretty useful when figuring out who to blame for
\r
59 > MIME rendering problems. It currently isn't very widely known, so it
\r
60 > seems worth distributing with notmuch.
\r
68 > I did a small amount whitespace cleanup compared to version in dkg's git =
\r
71 > devel/printmimestructure | 54 ++++++++++++++++++++++++++++++++++++++++++=
\r
73 > 1 file changed, 54 insertions(+)
\r
74 > create mode 100755 devel/printmimestructure
\r
76 > diff --git a/devel/printmimestructure b/devel/printmimestructure
\r
77 > new file mode 100755
\r
78 > index 0000000..b8084a9
\r
80 > +++ b/devel/printmimestructure
\r
82 > +#!/usr/bin/env python
\r
83 > +# -*- coding: utf-8 -*-
\r
85 > +# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
86 > +# License: GPLv3+
\r
88 > +# Updates: git://lair.fifthhorseman.net/~dkg/printmimestructure
\r
90 > +# This script reads a MIME message from stdin and produces a treelike
\r
91 > +# representation on it stdout.
\r
95 > +# 0 dkg@alice:~$ printmimestructure < 'Maildir/cur/1269025522.M338697P12=
\r
96 023.monkey,S=3D6459,W=3D6963:2,Sa'
\r
97 > +# =E2=94=94=E2=94=AC=E2=95=B4multipart/signed 6546 bytes
\r
98 > +# =E2=94=9C=E2=94=80=E2=95=B4text/plain inline 895 bytes
\r
99 > +# =E2=94=94=E2=94=80=E2=95=B4application/pgp-signature inline [signatur=
\r
101 > +# 0 dkg@alice:~$
\r
104 > +# If you want to number the parts, i suggest piping the output through
\r
105 > +# something like "cat -n"
\r
110 > +def test(z, prefix=3D''):
\r
111 > + fname =3D '' if z.get_filename() is None else ' [' + z.get_filename(=
\r
113 > + cset =3D '' if z.get_charset() is None else ' (' + z.get_charset() +=
\r
115 > + disp =3D z.get_params(None, header=3D'Content-Disposition')
\r
116 > + if (disp is None):
\r
117 > + disposition =3D ''
\r
119 > + disposition =3D ''
\r
121 > + if d[0] in [ 'attachment', 'inline' ]:
\r
122 > + disposition =3D ' ' + d[0]
\r
123 > + if (z.is_multipart()):
\r
124 > + print prefix + '=E2=94=AC=E2=95=B4' + z.get_content_type() + cse=
\r
125 t + disposition + fname, z.as_string().__len__().__str__() + ' bytes'
\r
126 > + if prefix.endswith('=E2=94=94'):
\r
127 > + prefix =3D prefix.rpartition('=E2=94=94')[0] + ' '
\r
128 > + if prefix.endswith('=E2=94=9C'):
\r
129 > + prefix =3D prefix.rpartition('=E2=94=9C')[0] + '=E2=94=82'
\r
130 > + parts =3D z.get_payload()
\r
132 > + while (i < parts.__len__()-1):
\r
133 > + test(parts[i], prefix + '=E2=94=9C')
\r
135 > + test(parts[i], prefix + '=E2=94=94')
\r
136 > + # FIXME: show epilogue?
\r
138 > + print prefix + '=E2=94=80=E2=95=B4'+ z.get_content_type() + cset=
\r
139 + disposition + fname, z.get_payload().__len__().__str__(), 'bytes'
\r
141 > +test(email.message_from_file(sys.stdin), '=E2=94=94')
\r
145 > _______________________________________________
\r
146 > notmuch mailing list
\r
147 > notmuch@notmuchmail.org
\r
148 > http://notmuchmail.org/mailman/listinfo/notmuch
\r