G_HOME=./tests/testgnupghome
-OUT_DIFF_1="$(./edward < ./tests/test1.eml | GNUPGHOME="$G_HOME" gpg 2> /dev/null | diff -Z -u ./tests/out1.txt - )"
+OUT_DIFF_1="$(time ./edward < ./tests/test1.eml | GNUPGHOME="$G_HOME" gpg 2> /dev/null | ./tests/flatten-mime | diff -Z -u ./tests/out1.txt - )"
if [ -n "$OUT_DIFF_1" ] ; then
echo "*** test 1 failed! difference:" >&2
echo "$OUT_DIFF_1" >&2
fi
-
--- /dev/null
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+"""***********************************************************************
+* "flatten-mime" is free software: you can redistribute it and/or modify *
+* it under the terms of the GNU Affero Public License as published by *
+* the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* "flatten-mime" 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 Affero Public License for more details. *
+* *
+* You should have received a copy of the GNU Affero Public License *
+* along with Edward. If not, see <http://www.gnu.org/licenses/>. *
+* *
+* Copyright (C) 2015 Andrew Engelbrecht (AGPLv3+) *
+**************************************************************************
+
+"""
+
+import sys
+import email.parser
+
+
+mime_text = sys.stdin.read()
+
+email_struct = email.parser.Parser().parsestr(mime_text)
+
+for subpart in email_struct.walk():
+ payload_b = subpart.get_payload(decode=True)
+
+ if payload_b:
+ payload = payload_b.decode("utf-8")
+
+ print(payload)
+
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: quoted-printable
-
thanks for the message!
> thanks for the message!
->=20
-> > =C3=9Cber Spa=C3=9F.
-> >=20
-> > qual =C3=A8 il suono di una mano sola?
-> >=20
-> > =E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF=E3=80=81=E3=81=8A=E5=85=
-=83=E6=B0=97=E3=81=A7=E3=81=99=E3=81=8B=EF=BC=9F
-> >=20
->=20
+>
+> > Über Spaß.
+> >
+> > qual è il suono di una mano sola?
+> >
+> > こんにちは、お元気ですか?
+> >
+>
> test.
->=20
+>
> -andrew
->=20
->=20
->=20
+>
+>
+>