summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-09-20 21:04:55 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-09-20 21:04:55 -0700
commitbabab12934608c9ad91c3fe12d2e8f57bcc19692 (patch)
treebe7d45326330c3ac85a10d67b1e0c8dc1e52171b
parent07541ca67c5774f172cbf7dbbf42c99220a433c1 (diff)
parentc3865570be223bc1876d69b3a910c5fae168ebb7 (diff)
downloadmailscripts-babab12934608c9ad91c3fe12d2e8f57bcc19692.tar.gz
Merge tag 'debian/0.11-1' into buster-bpo
mailscripts release 0.11-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear] # gpg: Signature made Sun 15 Sep 2019 08:18:22 AM MST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
-rw-r--r--Makefile2
-rw-r--r--debian/changelog12
-rw-r--r--debian/control4
-rw-r--r--debian/mailscripts.install1
-rw-r--r--debian/mailscripts.manpages1
-rwxr-xr-xemail-extract-openpgp-certs2
-rwxr-xr-xemail-print-mime-structure77
-rw-r--r--email-print-mime-structure.1.pod62
-rwxr-xr-xmaildir-import-patch2
-rw-r--r--mailscripts.el4
-rwxr-xr-xmbox2maildir2
-rwxr-xr-xmdmv2
-rw-r--r--notmuch-extract-patch/LICENSE8
-rwxr-xr-xnotmuch-extract-patch/notmuch-extract-patch2
-rwxr-xr-xnotmuch-import-patch2
-rwxr-xr-xnotmuch-slurp-debbug2
16 files changed, 172 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 48cb2fa..352f6f0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
MANPAGES=mdmv.1 mbox2maildir.1 \
notmuch-slurp-debbug.1 notmuch-extract-patch.1 maildir-import-patch.1 \
email-extract-openpgp-certs.1 \
+ email-print-mime-structure.1 \
notmuch-import-patch.1
all: $(MANPAGES)
@@ -10,5 +11,6 @@ clean:
%.1: %.1.pod
pod2man --section=1 --date="Debian Project" --center="User Commands" \
+ --utf8 \
--name=$(subst .1,,$@) \
$^ $@
diff --git a/debian/changelog b/debian/changelog
index daa7350..b7adf2b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+mailscripts (0.11-1) unstable; urgency=medium
+
+ * New script: email-print-mime-structure (Closes: #939993).
+ Imported from the notmuch project, which never shipped it in releases.
+ Thanks to Daniel Kahn Gillmor for the patches.
+ * Generate nroff output in UTF-8.
+ Thanks to Daniel Kahn Gillmor for the patch.
+ * Use 'https' instead of 'http' in various places (Closes: #939994).
+ Thanks to Daniel Kahn Gillmor for the patch.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Sun, 15 Sep 2019 08:13:41 -0700
+
mailscripts (0.10-1~bpo10+1) buster-backports; urgency=medium
* Rebuild for buster-backports.
diff --git a/debian/control b/debian/control
index 8667a6c..6d3a54f 100644
--- a/debian/control
+++ b/debian/control
@@ -55,3 +55,7 @@ Description: collection of scripts for manipulating e-mail on Debian
maildir-import-patch -- import a git patch series into a maildir
.
notmuch-import-patch -- import a git patch series into notmuch
+ .
+ email-print-mime-structure -- tree view of a message's MIME structure
+ .
+ email-extract-openpgp-certs -- extract OpenPGP certificates from a message
diff --git a/debian/mailscripts.install b/debian/mailscripts.install
index d6f69f5..99216c1 100644
--- a/debian/mailscripts.install
+++ b/debian/mailscripts.install
@@ -5,3 +5,4 @@ maildir-import-patch /usr/bin
notmuch-import-patch /usr/bin
notmuch-extract-patch/notmuch-extract-patch /usr/bin
email-extract-openpgp-certs /usr/bin
+email-print-mime-structure /usr/bin
diff --git a/debian/mailscripts.manpages b/debian/mailscripts.manpages
index ab761b2..6d7cb30 100644
--- a/debian/mailscripts.manpages
+++ b/debian/mailscripts.manpages
@@ -5,3 +5,4 @@ maildir-import-patch.1
notmuch-import-patch.1
notmuch-extract-patch.1
email-extract-openpgp-certs.1
+email-print-mime-structure.1
diff --git a/email-extract-openpgp-certs b/email-extract-openpgp-certs
index 2a95748..03b7753 100755
--- a/email-extract-openpgp-certs
+++ b/email-extract-openpgp-certs
@@ -13,7 +13,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
'''Extract all OpenPGP certificates from an e-mail message
diff --git a/email-print-mime-structure b/email-print-mime-structure
new file mode 100755
index 0000000..7adeb2b
--- /dev/null
+++ b/email-print-mime-structure
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2019 Daniel Kahn Gillmor
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+'''
+This script reads a MIME message from stdin and produces a treelike
+representation on it stdout.
+
+Example:
+0 dkg@alice:~$ printmimestructure < 'Maildir/cur/1269025522.M338697P12023.monkey,S=6459,W=6963:2,Sa'
+└┬╴multipart/signed 6546 bytes
+ ├─╴text/plain inline 895 bytes
+ └─╴application/pgp-signature inline [signature.asc] 836 bytes
+0 dkg@alice:~$
+
+If you want to number the parts, i suggest piping the output through
+something like "cat -n"
+'''
+import email
+import sys
+
+def print_part(z, prefix):
+ fname = '' if z.get_filename() is None else ' [' + z.get_filename() + ']'
+ cset = '' if z.get_charset() is None else ' (' + z.get_charset() + ')'
+ disp = z.get_params(None, header='Content-Disposition')
+ if (disp is None):
+ disposition = ''
+ else:
+ disposition = ''
+ for d in disp:
+ if d[0] in [ 'attachment', 'inline' ]:
+ disposition = ' ' + d[0]
+ if z.is_multipart():
+ nbytes = len(z.as_string())
+ else:
+ nbytes = len(z.get_payload())
+
+ print('{}{}{}{}{} {:d} bytes'.format(
+ prefix,
+ z.get_content_type(),
+ cset,
+ disposition,
+ fname,
+ nbytes,
+ ))
+
+def test(z, prefix=''):
+ if (z.is_multipart()):
+ print_part(z, prefix+'┬╴')
+ if prefix.endswith('└'):
+ prefix = prefix.rpartition('└')[0] + ' '
+ if prefix.endswith('├'):
+ prefix = prefix.rpartition('├')[0] + '│'
+ parts = z.get_payload()
+ i = 0
+ while (i < parts.__len__()-1):
+ test(parts[i], prefix + '├')
+ i += 1
+ test(parts[i], prefix + '└')
+ # FIXME: show epilogue?
+ else:
+ print_part(z, prefix+'─╴')
+
+test(email.message_from_file(sys.stdin), '└')
diff --git a/email-print-mime-structure.1.pod b/email-print-mime-structure.1.pod
new file mode 100644
index 0000000..ab1ec05
--- /dev/null
+++ b/email-print-mime-structure.1.pod
@@ -0,0 +1,62 @@
+=encoding utf8
+
+=head1 NAME
+
+email-print-mime-structure - display a tree-like view of the MIME structure of an e-mail
+
+=head1 SYNOPSIS
+
+B<email-print-mime-structure> <B<message.eml>
+
+=head1 DESCRIPTION
+
+B<email-print-mime-structure> reads a MIME message from stdin and
+produces a treelike representation to stdout.
+
+If the user wants the parts numbered, they can feed the output through
+something like "cat -n".
+
+
+=head1 OPTIONS
+
+None.
+
+=head1 EXAMPLE
+
+=over 4
+
+ $ email-print-mime-structure <test.eml
+ └┬╴multipart/signed 6546 bytes
+ ├─╴text/plain inline 895 bytes
+ └─╴application/pgp-signature inline [signature.asc] 836 bytes
+
+=back
+
+=head1 LIMITATIONS
+
+B<email-print-mime-structure> currently does not try to decrypt
+encrypted e-mails, so it cannot display the MIME structure that is
+inside the message's cryptographic envelope.
+
+B<email-print-mime-structure>'s output is not stable, and is not
+intended to be interpreted by machines, so please do not depend on it
+in scripts!
+
+B<email-print-mime-structure> displays some data from within the
+e-mail, but does not sanitize it before display. Some particularly
+cleverly-malformed MIME parameters might be able to induce apparent
+formatting changes or emit arbitrary characters to stdout.
+
+B<email-print-mime-structure> expects to be run in a UTF-8-friendly
+environment.
+
+=head1 SEE ALSO
+
+https://tools.ietf.org/html/rfc2045, https://tools.ietf.org/html/rfc2049
+
+=head1 AUTHOR
+
+B<email-print-mime-structure> and this manpage were written by Daniel
+Kahn Gillmor and Jameson Graef Rollins, with suggestions and feedback
+from many others in the community that develops the notmuch mail user
+agent. It originated in the notmuch source tree.
diff --git a/maildir-import-patch b/maildir-import-patch
index a17c6cb..f69a5e6 100755
--- a/maildir-import-patch
+++ b/maildir-import-patch
@@ -15,7 +15,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
import os
import sys
diff --git a/mailscripts.el b/mailscripts.el
index 0198a3c..f0002fc 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -1,7 +1,7 @@
;;; mailscripts.el --- functions to access tools in the mailscripts package
;; Author: Sean Whitton <spwhitton@spwhitton.name>
-;; Version: 0.9
+;; Version: 0.11
;; Package-Requires: (notmuch)
;; Copyright (C) 2018 Sean Whitton
@@ -17,7 +17,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
diff --git a/mbox2maildir b/mbox2maildir
index 351a37c..e2f8e23 100755
--- a/mbox2maildir
+++ b/mbox2maildir
@@ -15,7 +15,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Credits:
diff --git a/mdmv b/mdmv
index c81e52d..fa1533f 100755
--- a/mdmv
+++ b/mdmv
@@ -15,7 +15,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
import os
import sys
diff --git a/notmuch-extract-patch/LICENSE b/notmuch-extract-patch/LICENSE
index 94a9ed0..e600086 100644
--- a/notmuch-extract-patch/LICENSE
+++ b/notmuch-extract-patch/LICENSE
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
+<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+<https://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/notmuch-extract-patch/notmuch-extract-patch b/notmuch-extract-patch/notmuch-extract-patch
index df87a6c..cfd4464 100755
--- a/notmuch-extract-patch/notmuch-extract-patch
+++ b/notmuch-extract-patch/notmuch-extract-patch
@@ -15,7 +15,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
import mailbox
import sys
diff --git a/notmuch-import-patch b/notmuch-import-patch
index ea61634..5a8e589 100755
--- a/notmuch-import-patch
+++ b/notmuch-import-patch
@@ -15,7 +15,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
use strict;
use warnings;
diff --git a/notmuch-slurp-debbug b/notmuch-slurp-debbug
index d424236..ff5a54f 100755
--- a/notmuch-slurp-debbug
+++ b/notmuch-slurp-debbug
@@ -15,7 +15,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
use strict;
use warnings;