]> Sergey Matveev's repositories - public-inbox.git/commitdiff
remove most internal Email::MIME usage
authorEric Wong <e@yhbt.net>
Thu, 7 May 2020 21:05:55 +0000 (21:05 +0000)
committerEric Wong <e@yhbt.net>
Sat, 9 May 2020 08:59:10 +0000 (08:59 +0000)
We no longer load or use Email::MIME outside of comparison
tests.

66 files changed:
INSTALL
Makefile.PL
ci/deps.perl
lib/PublicInbox/Import.pm
lib/PublicInbox/MIME.pm
lib/PublicInbox/MsgTime.pm
lib/PublicInbox/TestCommon.pm
t/altid.t
t/altid_v2.t
t/cgi.t
t/content_id.t
t/convert-compact.t
t/edit.t
t/feed.t
t/filter_base.t
t/filter_mirror.t
t/filter_subjecttag.t
t/filter_vger.t
t/html_index.t
t/httpd.t
t/import.t
t/indexlevels-mirror.t
t/mda.t
t/mda_filter_rubylang.t
t/mid.t
t/mime.t
t/msg_iter.t
t/msgtime.t
t/multi-mid.t
t/nntp.t
t/nntpd-tls.t
t/nntpd.t
t/nulsubject.t
t/plack.t
t/precheck.t
t/psgi_attach.t
t/psgi_bad_mids.t
t/psgi_mount.t
t/psgi_multipart_not.t
t/psgi_scan_all.t
t/psgi_search.t
t/psgi_text.t
t/psgi_v2.t
t/purge.t
t/replace.t
t/reply.t
t/search-thr-index.t
t/search.t
t/solver_git.t
t/spamcheck_spamc.t
t/thread-cycle.t
t/time.t
t/v1-add-remove-add.t
t/v1reindex.t
t/v2-add-remove-add.t
t/v2mda.t
t/v2mirror.t
t/v2reindex.t
t/v2writable.t
t/watch_filter_rubylang.t
t/watch_maildir.t
t/watch_maildir_v2.t
t/www_altid.t
t/xcpdb-reshard.t
xt/msgtime_cmp.t
xt/perf-msgview.t

diff --git a/INSTALL b/INSTALL
index 2dd7dcff7013303091575e3c7e818a1fd50a6c8a..80cee7535f87c72ec8bdccb4382e09b89c5bbf7a 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -36,15 +36,18 @@ Beyond that, there is a long list of Perl modules required, starting with:
 * Digest::SHA                      typically installed with Perl
                                    rpm: perl-Digest-SHA
 
 * Digest::SHA                      typically installed with Perl
                                    rpm: perl-Digest-SHA
 
-* Email::MIME                      deb: libemail-mime-perl
-                                   pkg: p5-Email-MIME
-                                   rpm: perl-Email-MIME
-
 * URI::Escape                      deb: liburi-perl
                                    pkg: p5-URI
                                    rpm: perl-URI
                                    (for HTML/Atom generation)
 
 * URI::Escape                      deb: liburi-perl
                                    pkg: p5-URI
                                    rpm: perl-URI
                                    (for HTML/Atom generation)
 
+Email::MIME will be optional as of public-inbox v1.5.0,
+it may still be used in maintainer comparison tests:
+
+* Email::MIME                      deb: libemail-mime-perl
+                                   pkg: p5-Email-MIME
+                                   rpm: perl-Email-MIME
+
 Plack and Date::Parse are optional as of public-inbox v1.3.0,
 but required for older releases:
 
 Plack and Date::Parse are optional as of public-inbox v1.3.0,
 but required for older releases:
 
@@ -86,6 +89,11 @@ Numerous optional modules are likely to be useful as well:
                                    (speeds up process spawning on Linux,
                                     see public-inbox-daemon(8))
 
                                    (speeds up process spawning on Linux,
                                     see public-inbox-daemon(8))
 
+- Email::Address::XS               deb: libemail-address-xs-perl
+                                   pkg: pkg-Email-Address-XS
+                                   (correct parsing of tricky email
+                                    addresses, phrases and comments)
+
 - Plack::Middleware::ReverseProxy  deb: libplack-middleware-reverseproxy-perl
                                    pkg: p5-Plack-Middleware-ReverseProxy
                                    rpm: perl-Plack-Middleware-ReverseProxy
 - Plack::Middleware::ReverseProxy  deb: libplack-middleware-reverseproxy-perl
                                    pkg: p5-Plack-Middleware-ReverseProxy
                                    rpm: perl-Plack-Middleware-ReverseProxy
@@ -108,16 +116,6 @@ Numerous optional modules are likely to be useful as well:
 The following modules are typically pulled in by dependencies listed
 above, so there is no need to explicitly install them:
 
 The following modules are typically pulled in by dependencies listed
 above, so there is no need to explicitly install them:
 
-- Email::MIME::ContentType         deb: libemail-mime-contenttype-perl
-                                   pkg: p5-Email-MIME-ContentType
-                                   rpm: perl-Email-MIME-ContentType
-                                   (pulled in by Email::MIME)
-
-- Email::Simple                    deb: libemail-simple-perl
-                                   pkg: p5-Email-Simple
-                                   rpm: perl-Email-Simple
-                                   (pulled in by Email::MIME)
-
 * Encode                           deb: libperl5.$MINOR (or libencode-perl)
                                    pkg: perl5
                                    rpm: perl-Encode
 * Encode                           deb: libperl5.$MINOR (or libencode-perl)
                                    pkg: perl5
                                    rpm: perl-Encode
index 59345edb63f0c99dd999b6ccf29661ba577fe748..efbb59cbf939079f97bbb75eb04a2f7c40208295 100644 (file)
@@ -122,11 +122,6 @@ WriteMakefile(
                # `perl5' on FreeBSD
                # perl-Digest-SHA on RH-based
                'Digest::SHA' => 0,
                # `perl5' on FreeBSD
                # perl-Digest-SHA on RH-based
                'Digest::SHA' => 0,
-               'Email::MIME' => 0,
-
-               # the following should be pulled in by Email::MIME:
-               'Email::MIME::ContentType' => 0,
-               'Email::Simple' => 0,
 
                # libperl$PERL_VERSION or libencode-perl on Debian,
                # `perl5' on FreeBSD
 
                # libperl$PERL_VERSION or libencode-perl on Debian,
                # `perl5' on FreeBSD
index 06b4fbe0f2f3a0be7a939a94405fcf272528f9c1..48aaa9e46d49f4d1d3f0c760f101bef7ad805a0c 100755 (executable)
@@ -20,9 +20,6 @@ my $profiles = {
                perl
                Devel::Peek
                Digest::SHA
                perl
                Devel::Peek
                Digest::SHA
-               Email::Simple
-               Email::MIME
-               Email::MIME::ContentType
                Encode
                ExtUtils::MakeMaker
                IO::Compress::Gzip
                Encode
                ExtUtils::MakeMaker
                IO::Compress::Gzip
index 98aa7785efb1815f985fffe56b70aad772bca206..07d1859920003ea820c8ccd70cb536acee9e2f74 100644 (file)
@@ -213,13 +213,13 @@ sub get_mark {
 }
 
 # returns undef on non-existent
 }
 
 # returns undef on non-existent
-# ('MISMATCH', Email::MIME) on mismatch
-# (:MARK, Email::MIME) on success
+# ('MISMATCH', PublicInbox::Eml) on mismatch
+# (:MARK, PublicInbox::Eml) on success
 #
 # v2 callers should check with Xapian before calling this as
 # it is not idempotent.
 sub remove {
 #
 # v2 callers should check with Xapian before calling this as
 # it is not idempotent.
 sub remove {
-       my ($self, $mime, $msg) = @_; # mime = Email::MIME
+       my ($self, $mime, $msg) = @_; # mime = PublicInbox::Eml or Email::MIME
 
        my $path_type = $self->{path_type};
        my ($path, $err, $cur, $blob);
 
        my $path_type = $self->{path_type};
        my ($path, $err, $cur, $blob);
@@ -375,7 +375,7 @@ sub clean_tree_v2 ($$$) {
 # returns undef on duplicate
 # returns the :MARK of the most recent commit
 sub add {
 # returns undef on duplicate
 # returns the :MARK of the most recent commit
 sub add {
-       my ($self, $mime, $check_cb, $smsg) = @_; # mime = Email::MIME
+       my ($self, $mime, $check_cb, $smsg) = @_;
 
        my ($name, $email, $at, $ct, $subject) = extract_cmt_info($mime, $smsg);
        my $path_type = $self->{path_type};
 
        my ($name, $email, $at, $ct, $subject) = extract_cmt_info($mime, $smsg);
        my $path_type = $self->{path_type};
index b795b93b1054e93a43831e12b72d9683e63f99db..9077386ac2123fab3c28e57d7e8d65f239e9a48b 100644 (file)
@@ -3,6 +3,9 @@
 #
 # The license for this file differs from the rest of public-inbox.
 #
 #
 # The license for this file differs from the rest of public-inbox.
 #
+# We no longer load this in any of our code outside of maintainer
+# tests for compatibility.
+#
 # It monkey patches the "parts_multipart" subroutine with patches
 # from Matthew Horsfall <wolfsage@gmail.com> at:
 #
 # It monkey patches the "parts_multipart" subroutine with patches
 # from Matthew Horsfall <wolfsage@gmail.com> at:
 #
index 920e8f8a4e7d81f9aec43b0177f39652854f0b60..8596f01c71de9d1b824b6a0d804135888db810db 100644 (file)
@@ -138,7 +138,7 @@ sub time_response ($) {
 }
 
 sub msg_received_at ($) {
 }
 
 sub msg_received_at ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my @recvd = $hdr->header_raw('Received');
        my ($ts);
        foreach my $r (@recvd) {
        my @recvd = $hdr->header_raw('Received');
        my ($ts);
        foreach my $r (@recvd) {
@@ -153,7 +153,7 @@ sub msg_received_at ($) {
 }
 
 sub msg_date_only ($) {
 }
 
 sub msg_date_only ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my @date = $hdr->header_raw('Date');
        my ($ts);
        foreach my $d (@date) {
        my @date = $hdr->header_raw('Date');
        my ($ts);
        foreach my $d (@date) {
@@ -168,7 +168,7 @@ sub msg_date_only ($) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($;$) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($;$) {
-       my ($hdr, $fallback) = @_; # Email::MIME::Header
+       my ($hdr, $fallback) = @_; # PublicInbox::Eml
        my $ret;
        $ret = msg_received_at($hdr) and return time_response($ret);
        $ret = msg_date_only($hdr) and return time_response($ret);
        my $ret;
        $ret = msg_received_at($hdr) and return time_response($ret);
        $ret = msg_date_only($hdr) and return time_response($ret);
@@ -177,7 +177,7 @@ sub msg_timestamp ($;$) {
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($;$) {
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($;$) {
-       my ($hdr, $fallback) = @_; # Email::MIME::Header
+       my ($hdr, $fallback) = @_; # PublicInbox::Eml
        my $ret;
        $ret = msg_date_only($hdr) and return time_response($ret);
        $ret = msg_received_at($hdr) and return time_response($ret);
        my $ret;
        $ret = msg_date_only($hdr) and return time_response($ret);
        $ret = msg_received_at($hdr) and return time_response($ret);
index 978c3cd7bafaf4a1cc82a7a78724296453f49cbd..d952ee6d97715fc644b1dcf0e663d977821c8413 100644 (file)
@@ -8,7 +8,6 @@ use parent qw(Exporter);
 use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD :seek);
 use POSIX qw(dup2);
 use IO::Socket::INET;
 use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD :seek);
 use POSIX qw(dup2);
 use IO::Socket::INET;
-use PublicInbox::MIME; # temporary
 our @EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
        run_script start_script key2sub xsys xqx mime_load eml_load);
 
 our @EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
        run_script start_script key2sub xsys xqx mime_load eml_load);
 
@@ -23,7 +22,7 @@ sub mime_load ($) {
 sub eml_load ($) {
        my ($path, $cb) = @_;
        open(my $fh, '<', $path) or die "open $path: $!";
 sub eml_load ($) {
        my ($path, $cb) = @_;
        open(my $fh, '<', $path) or die "open $path: $!";
-       binmode $fh;
+       require PublicInbox::Eml;
        PublicInbox::Eml->new(\(do { local $/; <$fh> }));
 }
 
        PublicInbox::Eml->new(\(do { local $/; <$fh> }));
 }
 
index c7a3601a6b196f03f5111c11f89bb0b8e57f1528..670a39633755149c3260bb5c3b7470e1fabfeb3e 100644 (file)
--- a/t/altid.t
+++ b/t/altid.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_mods(qw(DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::Msgmap';
 use_ok 'PublicInbox::SearchIdx';
 require_mods(qw(DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::Msgmap';
 use_ok 'PublicInbox::SearchIdx';
@@ -27,7 +27,7 @@ my $ibx;
        my $git = PublicInbox::Git->new($git_dir);
        my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
        $im->init_bare;
        my $git = PublicInbox::Git->new($git_dir);
        my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
        $im->init_bare;
-       $im->add(PublicInbox::MIME->new(<<'EOF'));
+       $im->add(PublicInbox::Eml->new(<<'EOF'));
 From: a@example.com
 To: b@example.com
 Subject: boo!
 From: a@example.com
 To: b@example.com
 Subject: boo!
index 3ac294f05b3b005f9e2683b165d4daeb2d4db376..28a047d992eff345fe10d1c0dc85a72b1cf9b2a6 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
 use PublicInbox::TestCommon;
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
@@ -31,7 +31,7 @@ my $ibx = {
 };
 $ibx = PublicInbox::Inbox->new($ibx);
 my $v2w = PublicInbox::V2Writable->new($ibx, 1);
 };
 $ibx = PublicInbox::Inbox->new($ibx);
 my $v2w = PublicInbox::V2Writable->new($ibx, 1);
-$v2w->add(PublicInbox::MIME->new(<<'EOF'));
+$v2w->add(PublicInbox::Eml->new(<<'EOF'));
 From: a@example.com
 To: b@example.com
 Subject: boo!
 From: a@example.com
 To: b@example.com
 Subject: boo!
diff --git a/t/cgi.t b/t/cgi.t
index 42a343d3040f06303fb42a09cce5c22f6b07f65a..d1f971504efb43aaf26b2681087278f57460e5f4 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -5,7 +5,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 use PublicInbox::Import;
 require_mods(qw(Plack::Handler::CGI Plack::Util));
 use PublicInbox::TestCommon;
 use PublicInbox::Import;
 require_mods(qw(Plack::Handler::CGI Plack::Util));
@@ -45,7 +45,7 @@ my $im = PublicInbox::InboxWritable->new($ibx)->importer;
        local $ENV{HOME} = $home;
 
        # inject some messages:
        local $ENV{HOME} = $home;
 
        # inject some messages:
-       my $mime = PublicInbox::MIME->new(<<EOF);
+       my $mime = PublicInbox::Eml->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -62,7 +62,7 @@ EOF
        ok($im->add($mime), 'added big message');
 
        # deliver a reply, too
        ok($im->add($mime), 'added big message');
 
        # deliver a reply, too
-       $mime = PublicInbox::MIME->new(<<EOF);
+       $mime = PublicInbox::Eml->new(<<EOF);
 From: You <you\@example.com>
 To: Me <me\@example.com>
 Cc: $addr
 From: You <you\@example.com>
 To: Me <me\@example.com>
 Cc: $addr
@@ -79,7 +79,7 @@ EOF
        ok($im->add($mime), 'added reply');
 
        my $slashy_mid = 'slashy/asdf@example.com';
        ok($im->add($mime), 'added reply');
 
        my $slashy_mid = 'slashy/asdf@example.com';
-       my $slashy = PublicInbox::MIME->new(<<EOF);
+       my $slashy = PublicInbox::Eml->new(<<EOF);
 From: You <you\@example.com>
 To: Me <me\@example.com>
 Cc: $addr
 From: You <you\@example.com>
 To: Me <me\@example.com>
 Cc: $addr
index 0325164df77de292075b2ec8c885e5642cf8a1b8..9df81aa829379e92f2027fdc1724b526789082c4 100644 (file)
@@ -4,9 +4,9 @@ use strict;
 use warnings;
 use Test::More;
 use PublicInbox::ContentId qw(content_id);
 use warnings;
 use Test::More;
 use PublicInbox::ContentId qw(content_id);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
@@ -17,7 +17,7 @@ hello world
 EOF
 
 my $orig = content_id($mime);
 EOF
 
 my $orig = content_id($mime);
-my $reload = content_id(PublicInbox::MIME->new($mime->as_string));
+my $reload = content_id(PublicInbox::Eml->new($mime->as_string));
 is($orig, $reload, 'content_id matches after serialization');
 
 foreach my $h (qw(From To Cc)) {
 is($orig, $reload, 'content_id matches after serialization');
 
 foreach my $h (qw(From To Cc)) {
index 1627e0195b5219cd73008cb5e5e87f678db25078..80efc19c79816a57cf7e6af3115e80caa63c0dda 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Spawn qw(which);
 use PublicInbox::TestCommon;
 require_git(2.6);
 use PublicInbox::Spawn qw(which);
 use PublicInbox::TestCommon;
 require_git(2.6);
@@ -26,7 +26,7 @@ ok(PublicInbox::Import::run_die([qw(git) , "--git-dir=$ibx->{inboxdir}",
        qw(config core.sharedRepository 0644)]), 'set sharedRepository');
 $ibx = PublicInbox::Inbox->new($ibx);
 my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx);
        qw(config core.sharedRepository 0644)]), 'set sharedRepository');
 $ibx = PublicInbox::Inbox->new($ibx);
 my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx);
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
index d8833f9c64a1d01f2b81e72d809a692bfe3d75a8..1a5698f69231232f5783cbc606f814ed00ff355f 100644 (file)
--- a/t/edit.t
+++ b/t/edit.t
@@ -28,7 +28,7 @@ my $file = 't/data/0001.patch';
 open my $fh, '<', $file or die "open: $!";
 my $raw = do { local $/; <$fh> };
 my $im = $ibx->importer(0);
 open my $fh, '<', $file or die "open: $!";
 my $raw = do { local $/; <$fh> };
 my $im = $ibx->importer(0);
-my $mime = PublicInbox::MIME->new($raw);
+my $mime = PublicInbox::Eml->new($raw);
 my $mid = mid_clean($mime->header('Message-Id'));
 ok($im->add($mime), 'add message to be edited');
 $im->done;
 my $mid = mid_clean($mime->header('Message-Id'));
 ok($im->add($mime), 'add message to be edited');
 $im->done;
@@ -41,7 +41,7 @@ $t = '-F FILE'; {
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean prefix/bool pfx/'";
        $cmd = [ '-edit', "-F$file", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edit OK");
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean prefix/bool pfx/'";
        $cmd = [ '-edit', "-F$file", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edit OK");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/bool pfx/, "$t message edited");
        like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
 }
        like($cur->header('Subject'), qr/bool pfx/, "$t message edited");
        like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
 }
@@ -51,7 +51,7 @@ $t = '-m MESSAGE_ID'; {
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edit OK");
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edit OK");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/boolean prefix/, "$t message edited");
        like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
 }
        like($cur->header('Subject'), qr/boolean prefix/, "$t message edited");
        like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
 }
@@ -63,7 +63,7 @@ $t = 'no-op -m MESSAGE_ID'; {
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        my $prev = $cur;
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        my $prev = $cur;
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        is_deeply($cur, $prev, "$t makes no change");
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change message");
        is_deeply($cur, $prev, "$t makes no change");
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change message");
@@ -79,7 +79,7 @@ $t = 'no-op -m MESSAGE_ID w/Status: header'; { # because mutt does it
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        my $prev = $cur;
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        my $prev = $cur;
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        is_deeply($cur, $prev, "$t makes no change");
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change message");
        is_deeply($cur, $prev, "$t makes no change");
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change message");
@@ -94,7 +94,7 @@ $t = '-m MESSAGE_ID can change Received: headers'; {
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Received: x\\n\$&/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Received: x\\n\$&/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change Subject");
        is($cur->header('Received'), 'x', 'added Received header');
        like($cur->header('Subject'), qr/boolean prefix/,
                "$t does not change Subject");
        is($cur->header('Received'), 'x', 'added Received header');
@@ -127,7 +127,7 @@ $t = 'mailEditor set in config'; {
        local $ENV{GIT_EDITOR} = 'echo should not run';
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edited message");
        local $ENV{GIT_EDITOR} = 'echo should not run';
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t edited message");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/bool pfx/, "$t message edited");
        unlike($out, qr/should not run/, 'did not run GIT_EDITOR');
 }
        like($cur->header('Subject'), qr/bool pfx/, "$t message edited");
        unlike($out, qr/should not run/, 'did not run GIT_EDITOR');
 }
@@ -137,20 +137,20 @@ $t = '--raw and mbox escaping'; {
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^\$/\\nFrom not mbox\\n/'";
        $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^\$/\\nFrom not mbox\\n/'";
        $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->body, qr/^From not mbox/sm, 'put "From " line into body');
 
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^>From not/\$& an/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds with mbox escaping");
        like($cur->body, qr/^From not mbox/sm, 'put "From " line into body');
 
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^>From not/\$& an/'";
        $cmd = [ '-edit', "-m$mid", $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds with mbox escaping");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->body, qr/^From not an mbox/sm,
                'changed "From " line unescaped');
 
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^From not an mbox\\n//s'";
        $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds again");
        like($cur->body, qr/^From not an mbox/sm,
                'changed "From " line unescaped');
 
        local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^From not an mbox\\n//s'";
        $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ];
        ok(run_script($cmd, undef, $opt), "$t succeeds again");
-       $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
+       $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        unlike($cur->body, qr/^From not an mbox/sm, "$t restored body");
 }
 
        unlike($cur->body, qr/^From not an mbox/sm, "$t restored body");
 }
 
index 373a1de825a72f647f4d25d818e6a58dfb0427db..5ad90a07c1c8c1bd0f346f661b7170567f473965 100644 (file)
--- a/t/feed.t
+++ b/t/feed.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Feed;
 use PublicInbox::Import;
 use PublicInbox::Inbox;
 use PublicInbox::Feed;
 use PublicInbox::Import;
 use PublicInbox::Inbox;
@@ -36,7 +36,7 @@ my $im = PublicInbox::Import->new($git, $ibx->{name}, 'test@example');
 {
        $im->init_bare;
        foreach my $i (1..6) {
 {
        $im->init_bare;
        foreach my $i (1..6) {
-               my $mime = PublicInbox::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 From: ME <me\@example.com>
 To: U <u\@example.com>
 Message-Id: <$i\@example.com>
 From: ME <me\@example.com>
 To: U <u\@example.com>
 Message-Id: <$i\@example.com>
@@ -95,7 +95,7 @@ EOF
        # add a new spam message
        my $spam;
        {
        # add a new spam message
        my $spam;
        {
-               $spam = PublicInbox::MIME->new(<<EOF);
+               $spam = PublicInbox::Eml->new(<<EOF);
 From: SPAMMER <spammer\@example.com>
 To: U <u\@example.com>
 Message-Id: <this-is-spam\@example.com>
 From: SPAMMER <spammer\@example.com>
 To: U <u\@example.com>
 Message-Id: <this-is-spam\@example.com>
index bbd64189fb5fa2a2484d100bd6a3035708ecade0..47d0220f567ce3791c91f67dce900e43f3b2fa1d 100644 (file)
@@ -21,13 +21,13 @@ use_ok 'PublicInbox::Filter::Base';
 
 {
        my $f = PublicInbox::Filter::Base->new;
 
 {
        my $f = PublicInbox::Filter::Base->new;
-       my $email = mime_load 't/filter_base-xhtml.eml';
+       my $email = eml_load 't/filter_base-xhtml.eml';
        is($f->delivery($email), 100, "xhtml rejected");
 }
 
 {
        my $f = PublicInbox::Filter::Base->new;
        is($f->delivery($email), 100, "xhtml rejected");
 }
 
 {
        my $f = PublicInbox::Filter::Base->new;
-       my $email = mime_load 't/filter_base-junk.eml';
+       my $email = eml_load 't/filter_base-junk.eml';
        is($f->delivery($email), 100, 'proprietary format rejected on glob');
 }
 
        is($f->delivery($email), 100, 'proprietary format rejected on glob');
 }
 
index 0e641a03ca61544a7abfacf8d238d3084acaaade..5bc7f3f406d8c29a0fdc50ef7ce2c45c35acc085 100644 (file)
@@ -9,7 +9,7 @@ use_ok 'PublicInbox::Filter::Mirror';
 my $f = PublicInbox::Filter::Mirror->new;
 ok($f, 'created PublicInbox::Filter::Mirror object');
 {
 my $f = PublicInbox::Filter::Mirror->new;
 ok($f, 'created PublicInbox::Filter::Mirror object');
 {
-       my $email = mime_load 't/mda-mime.eml';
+       my $email = eml_load 't/mda-mime.eml';
        is($f->ACCEPT, $f->delivery($email), 'accept any trash that comes');
 }
 
        is($f->ACCEPT, $f->delivery($email), 'accept any trash that comes');
 }
 
index 9b397b8c2466e8fd44c04ebdbbff1b0fa5ae8b4f..75effa2769a5ad9052dc49b9e96d26c67f38514c 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use_ok 'PublicInbox::Filter::SubjectTag';
 
 my $f = eval { PublicInbox::Filter::SubjectTag->new };
 use_ok 'PublicInbox::Filter::SubjectTag';
 
 my $f = eval { PublicInbox::Filter::SubjectTag->new };
@@ -11,7 +11,7 @@ like($@, qr/tag not defined/, 'error without args');
 $f = PublicInbox::Filter::SubjectTag->new('-tag', '[foo]');
 is(ref $f, 'PublicInbox::Filter::SubjectTag', 'new object created');
 
 $f = PublicInbox::Filter::SubjectTag->new('-tag', '[foo]');
 is(ref $f, 'PublicInbox::Filter::SubjectTag', 'new object created');
 
-my $mime = PublicInbox::MIME->new(<<EOF);
+my $mime = PublicInbox::Eml->new(<<EOF);
 To: you <you\@example.com>
 Subject: =?UTF-8?B?UmU6IFtmb29dIEVsw4PCqWFub3I=?=
 
 To: you <you\@example.com>
 Subject: =?UTF-8?B?UmU6IFtmb29dIEVsw4PCqWFub3I=?=
 
index 9d71f16d03c8463980f4742ad21f3be277d4be6d..ca5a6ca720871ee8596efa9093343fea63f2721a 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use_ok 'PublicInbox::Filter::Vger';
 
 my $f = PublicInbox::Filter::Vger->new;
 use_ok 'PublicInbox::Filter::Vger';
 
 my $f = PublicInbox::Filter::Vger->new;
@@ -21,7 +21,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 EOF
 
 Please read the FAQ at  http://www.tux.org/lkml/
 EOF
 
-       my $mime = PublicInbox::MIME->new($lkml);
+       my $mime = PublicInbox::Eml->new($lkml);
        $mime = $f->delivery($mime);
        is("keep this\n", $mime->body, 'normal message filtered OK');
 }
        $mime = $f->delivery($mime);
        is("keep this\n", $mime->body, 'normal message filtered OK');
 }
@@ -37,7 +37,7 @@ the body of a message to majordomo@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 EOF
 
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 EOF
 
-       my $mime = PublicInbox::MIME->new($no_nl);
+       my $mime = PublicInbox::Eml->new($no_nl);
        $mime = $f->delivery($mime);
        is('OSX users :P', $mime->body, 'missing trailing LF in original OK');
 }
        $mime = $f->delivery($mime);
        is('OSX users :P', $mime->body, 'missing trailing LF in original OK');
 }
index 51897532f26a3f71ceaf1d13ccbba70ff5536301..80f81577e2aee2d875a772678e26b665bc8ae877 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Feed;
 use PublicInbox::Git;
 use PublicInbox::Import;
 use PublicInbox::Feed;
 use PublicInbox::Git;
 use PublicInbox::Import;
@@ -32,7 +32,7 @@ my $im = PublicInbox::Import->new($git, 'tester', 'test@example');
                        $mid_line .= "In-Reply-To: $prev";
                }
                $prev = $mid;
                        $mid_line .= "In-Reply-To: $prev";
                }
                $prev = $mid;
-               my $mime = PublicInbox::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 From: ME <me\@example.com>
 To: U <u\@example.com>
 $mid_line
 From: ME <me\@example.com>
 To: U <u\@example.com>
 $mid_line
index f4fbd5330be2e0b874c579216eeff56ed7f7f12c..7404eb8b691156a7f820eea4310c037e8d78684f 100644 (file)
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use Socket qw(IPPROTO_TCP SOL_SOCKET);
 require_mods(qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status));
 
 use Socket qw(IPPROTO_TCP SOL_SOCKET);
 require_mods(qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status));
 
@@ -28,7 +28,7 @@ use_ok 'PublicInbox::Import';
 
        # ensure successful message delivery
        {
 
        # ensure successful message delivery
        {
-               my $mime = PublicInbox::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
index ba4abd9cb321e0cba0c741ed8168285e590a56c6..3f308299148f4e20ff8b947fc17bc68b4808ecf6 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Git;
 use PublicInbox::Import;
 use PublicInbox::Spawn qw(spawn);
 use PublicInbox::Git;
 use PublicInbox::Import;
 use PublicInbox::Spawn qw(spawn);
@@ -15,7 +15,7 @@ my ($dir, $for_destroy) = tmpdir();
 my $git = PublicInbox::Git->new($dir);
 my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
 $im->init_bare;
 my $git = PublicInbox::Git->new($dir);
 my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
 $im->init_bare;
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
index dcd5dc39128ec8f0f3884e1f458cd117062e13d2..704f7e1174e3198e6c0bb6e6b1fc5cc5c3a48fd6 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Inbox;
 use PublicInbox::InboxWritable;
 require PublicInbox::Admin;
 use PublicInbox::Inbox;
 use PublicInbox::InboxWritable;
 require PublicInbox::Admin;
@@ -12,7 +12,7 @@ my $PI_TEST_VERSION = $ENV{PI_TEST_VERSION} || 2;
 require_git('2.6') if $PI_TEST_VERSION == 2;
 require_mods(qw(DBD::SQLite));
 
 require_git('2.6') if $PI_TEST_VERSION == 2;
 require_mods(qw(DBD::SQLite));
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
diff --git a/t/mda.t b/t/mda.t
index 03cc4bc3c444cbd0531b524c553f3f4d05be98e5..759c0b020abc661addd2752787e9c95c62ea0b5c 100644 (file)
--- a/t/mda.t
+++ b/t/mda.t
@@ -62,7 +62,7 @@ local $ENV{GIT_COMMITTER_NAME} = eval {
        use PublicInbox::MDA;
        use PublicInbox::Address;
        use Encode qw/encode/;
        use PublicInbox::MDA;
        use PublicInbox::Address;
        use Encode qw/encode/;
-       my $msg = mime_load 't/utf8.eml';
+       my $msg = eml_load 't/utf8.eml';
        my $from = $msg->header('From');
        my ($author) = PublicInbox::Address::names($from);
        my ($email) = PublicInbox::Address::emails($from);
        my $from = $msg->header('From');
        my ($author) = PublicInbox::Address::names($from);
        my ($email) = PublicInbox::Address::emails($from);
@@ -229,7 +229,7 @@ EOF
                "learned ham idempotently ");
 
        # ensure trained email is filtered, too
                "learned ham idempotently ");
 
        # ensure trained email is filtered, too
-       my $mime = mime_load 't/mda-mime.eml';
+       my $mime = eml_load 't/mda-mime.eml';
        ($mid) = ($mime->header_raw('message-id') =~ /<([^>]+)>/);
        {
                $in = $mime->as_string;
        ($mid) = ($mime->header_raw('message-id') =~ /<([^>]+)>/);
        {
                $in = $mime->as_string;
index f2cbe9d59584a8c3b341d72057defc74ebd368ff..483fcb8554943bfcd664291180ced603307bc03c 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 require_git(2.6);
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 require_git(2.6);
diff --git a/t/mid.t b/t/mid.t
index 0ad81d7da8be71011bdb0cef047ecaec73519053..3b8f41087e570ee78319e4df7f09ae7139cd8dd6 100644 (file)
--- a/t/mid.t
+++ b/t/mid.t
@@ -2,7 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::MID qw(mid_escape mids references mids_for_index id_compress);
 
 is(mid_escape('foo!@(bar)'), 'foo!@(bar)');
 use PublicInbox::MID qw(mid_escape mids references mids_for_index id_compress);
 
 is(mid_escape('foo!@(bar)'), 'foo!@(bar)');
@@ -16,7 +16,7 @@ like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
 is(id_compress('foobar-wtf'), 'foobar-wtf', 'regular ID not compressed');
 
 {
 is(id_compress('foobar-wtf'), 'foobar-wtf', 'regular ID not compressed');
 
 {
-       my $mime = PublicInbox::MIME->new("Message-ID: <mid-1\@a>\n\n");
+       my $mime = PublicInbox::Eml->new("Message-ID: <mid-1\@a>\n\n");
        $mime->header_set('X-Alt-Message-ID', '<alt-id-for-nntp>');
        is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case');
        $mime->header_set('Message-Id', '<mid-1@a>', '<mid-2@b>');
        $mime->header_set('X-Alt-Message-ID', '<alt-id-for-nntp>');
        is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case');
        $mime->header_set('Message-Id', '<mid-1@a>', '<mid-2@b>');
index b9a4d66b098cd2fde269576953c629ede97e8777..d17ec58e92dcbb42493f1d89e1291ada984c67cf 100644 (file)
--- a/t/mime.t
+++ b/t/mime.t
@@ -1,16 +1,23 @@
+#!perl -w
 # Copyright (C) 2017-2020 all contributors <meta@public-inbox.org>
 # This library is free software; you can redistribute it and/or modify
 # it under the same terms as Perl itself.
 # Artistic or GPL-1+ <https://www.gnu.org/licenses/gpl-1.0.txt>
 use strict;
 # Copyright (C) 2017-2020 all contributors <meta@public-inbox.org>
 # This library is free software; you can redistribute it and/or modify
 # it under the same terms as Perl itself.
 # Artistic or GPL-1+ <https://www.gnu.org/licenses/gpl-1.0.txt>
 use strict;
-use warnings;
 use Test::More;
 use Test::More;
-use_ok 'PublicInbox::MIME';
+use PublicInbox::TestCommon;
 use PublicInbox::MsgIter;
 use PublicInbox::MsgIter;
-
-local $SIG{__WARN__} = sub {};
-my $msg = PublicInbox::MIME->new(
-'From:   Richard Hansen <hansenr@google.com>
+my @classes = qw(PublicInbox::Eml);
+SKIP: {
+       require_mods('Email::MIME', 1);
+       push @classes, 'PublicInbox::MIME';
+};
+use_ok $_ for @classes;
+local $SIG{__WARN__} = sub {}; # needed for old Email::Simple (used by E::M)
+
+for my $cls (@classes) {
+       my $msg = PublicInbox::MIME->new(<<'EOF');
+From:   Richard Hansen <hansenr@google.com>
 To:     git@vger.kernel.org
 Cc:     Richard Hansen <hansenr@google.com>
 Subject: [PATCH 0/2] minor diff orderfile documentation improvements
 To:     git@vger.kernel.org
 Cc:     Richard Hansen <hansenr@google.com>
 Subject: [PATCH 0/2] minor diff orderfile documentation improvements
@@ -40,10 +47,11 @@ Content-Description: (truncated) S/MIME Cryptographic Signature
 dkTlB69771K2eXK4LcHSH/2LqX+VYa3K44vrx1ruzjXdNWzIpKBy0weFNiwnJCGofvCysM2RCSI1
 --94eb2c0bc864b76ba30545b2bca9--
 
 dkTlB69771K2eXK4LcHSH/2LqX+VYa3K44vrx1ruzjXdNWzIpKBy0weFNiwnJCGofvCysM2RCSI1
 --94eb2c0bc864b76ba30545b2bca9--
 
-');
+EOF
 
 
-my @parts = $msg->parts;
-my $exp = 'Richard Hansen (2):
+       my @parts = $msg->parts;
+       my $exp = <<EOF;
+Richard Hansen (2):
   diff: document behavior of relative diff.orderFile
   diff: document the pattern format for diff.orderFile
 
   diff: document behavior of relative diff.orderFile
   diff: document the pattern format for diff.orderFile
 
@@ -51,13 +59,12 @@ my $exp = 'Richard Hansen (2):
  Documentation/diff-options.txt | 3 ++-
  2 files changed, 6 insertions(+), 2 deletions(-)
 
  Documentation/diff-options.txt | 3 ++-
  2 files changed, 6 insertions(+), 2 deletions(-)
 
-';
-
-ok($msg->isa('Email::MIME'), 'compatible with Email::MIME');
-is($parts[0]->body, $exp, 'body matches expected');
+EOF
 
 
+       is($parts[0]->body, $exp, 'body matches expected');
 
 
-my $raw = q^Date:   Wed, 18 Jan 2017 13:28:32 -0500
+       my $raw = <<'EOF';
+Date:   Wed, 18 Jan 2017 13:28:32 -0500
 From:   Santiago Torres <santiago@nyu.edu>
 To:     Junio C Hamano <gitster@pobox.com>
 Cc:     git@vger.kernel.org, peff@peff.net, sunshine@sunshineco.com,
 From:   Santiago Torres <santiago@nyu.edu>
 To:     Junio C Hamano <gitster@pobox.com>
 Cc:     git@vger.kernel.org, peff@peff.net, sunshine@sunshineco.com,
@@ -92,28 +99,30 @@ Content-Type: application/pgp-signature; name="signature.asc"
 
 --r24xguofrazenjwe--
 
 
 --r24xguofrazenjwe--
 
-^;
-
-$msg = PublicInbox::MIME->new($raw);
-my $nr = 0;
-msg_iter($msg, sub {
-       my ($part, $level, @ex) = @{$_[0]};
-       is($level, 1, 'at expected level');
-       if (join('fail if $#ex > 0', @ex) eq '1') {
-               is($part->body_str, "your tree directly? \r\n", 'body OK');
-       } elsif (join('fail if $#ex > 0', @ex) eq '2') {
-               is($part->body, "-----BEGIN PGP SIGNATURE-----\n\n" .
-                               "=7wIb\n" .
-                               "-----END PGP SIGNATURE-----\n",
-                       'sig "matches"');
-       } else {
-               fail "unexpected part\n";
-       }
-       $nr++;
-});
-
-is($nr, 2, 'got 2 parts');
-is($msg->as_string, $raw,
-       'stringified sufficiently close to original');
+EOF
+
+       $msg = $cls->new($raw);
+       my $nr = 0;
+       msg_iter($msg, sub {
+               my ($part, $level, @ex) = @{$_[0]};
+               is($level, 1, 'at expected level');
+               if (join('fail if $#ex > 0', @ex) eq '1') {
+                       is($part->body_str, "your tree directly? \r\n",
+                       'body OK');
+               } elsif (join('fail if $#ex > 0', @ex) eq '2') {
+                       is($part->body, "-----BEGIN PGP SIGNATURE-----\n\n" .
+                                       "=7wIb\n" .
+                                       "-----END PGP SIGNATURE-----\n",
+                               'sig "matches"');
+               } else {
+                       fail "unexpected part\n";
+               }
+               $nr++;
+       });
+
+       is($nr, 2, 'got 2 parts');
+       is($msg->as_string, $raw,
+               'stringified sufficiently close to original');
+}
 
 done_testing();
 
 done_testing();
index e8115e2584c7ba7a0ccf58fab7511a123e490eb0..4ee3a201c797f4570a5ca2a1e719f062b442a71c 100644 (file)
@@ -8,7 +8,7 @@ use PublicInbox::Hval qw(ascii_html);
 use_ok('PublicInbox::MsgIter');
 
 {
 use_ok('PublicInbox::MsgIter');
 
 {
-       my $mime = mime_load 't/msg_iter-order.eml';
+       my $mime = eml_load 't/msg_iter-order.eml';
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -20,7 +20,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
 }
 
 {
-       my $mime = mime_load 't/msg_iter-nested.eml';
+       my $mime = eml_load 't/msg_iter-nested.eml';
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -33,7 +33,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
 }
 
 {
-       my $mime = mime_load 't/iso-2202-jp.eml';
+       my $mime = eml_load 't/iso-2202-jp.eml';
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -46,7 +46,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
 }
 
 {
-       my $mime = mime_load 't/x-unknown-alpine.eml';
+       my $mime = eml_load 't/x-unknown-alpine.eml';
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
index d9f8e6417d5bd3de73c636a5a1c2cf9327e7a0ec..89fd9e37b85a13ec87079b1a7eb0f5bff645ec34 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::MsgTime;
 use PublicInbox::TestCommon;
 
 use PublicInbox::MsgTime;
 use PublicInbox::TestCommon;
 
@@ -11,7 +11,7 @@ our $received_date = 'Mon, 22 Jan 2007 13:16:24 -0500';
 sub datestamp ($) {
        my ($date) = @_;
        local $SIG{__WARN__} = sub {};  # Suppress warnings
 sub datestamp ($) {
        my ($date) = @_;
        local $SIG{__WARN__} = sub {};  # Suppress warnings
-       my $mime = PublicInbox::MIME->new(<<"EOF");
+       my $mime = PublicInbox::Eml->new(<<"EOF");
 From: a\@example.com
 To: b\@example.com
 Subject: this is a subject
 From: a\@example.com
 To: b\@example.com
 Subject: this is a subject
@@ -30,7 +30,7 @@ EOF
 sub timestamp ($) {
        my ($received) = @_;
        local $SIG{__WARN__} = sub {};  # Suppress warnings
 sub timestamp ($) {
        my ($received) = @_;
        local $SIG{__WARN__} = sub {};  # Suppress warnings
-       my $mime = PublicInbox::MIME->new(<<"EOF");
+       my $mime = PublicInbox::Eml->new(<<"EOF");
 From: a\@example.com
 To: b\@example.com
 Subject: this is a subject
 From: a\@example.com
 To: b\@example.com
 Subject: this is a subject
index 5afb96933209d3e5f7e306f073a4764e9ba26f4a..91c8597e2e61f1815f6f4976e4aa59365b266d46 100644 (file)
@@ -2,7 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 use PublicInbox::InboxWritable;
 require_git(2.6);
 use PublicInbox::TestCommon;
 use PublicInbox::InboxWritable;
 require_git(2.6);
@@ -11,7 +11,7 @@ require PublicInbox::SearchIdx;
 my $delay = $ENV{TEST_DELAY_CONVERT};
 
 my $addr = 'test@example.com';
 my $delay = $ENV{TEST_DELAY_CONVERT};
 
 my $addr = 'test@example.com';
-my $bad = PublicInbox::MIME->new(<<EOF);
+my $bad = PublicInbox::Eml->new(<<EOF);
 Message-ID: <a\@example.com>
 Message-ID: <b\@example.com>
 From: a\@example.com
 Message-ID: <a\@example.com>
 Message-ID: <b\@example.com>
 From: a\@example.com
@@ -20,7 +20,7 @@ Subject: bad
 
 EOF
 
 
 EOF
 
-my $good = PublicInbox::MIME->new(<<EOF);
+my $good = PublicInbox::Eml->new(<<EOF);
 Message-ID: <b\@example.com>
 From: b\@example.com
 To: $addr
 Message-ID: <b\@example.com>
 From: b\@example.com
 To: $addr
index 35fb55b42ccfec723a2dfa734222d8aedd648b9c..2a9f3a4f6ebdd2e69d58cffe4e3ccb4e6bfb019b 100644 (file)
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_mods(qw(DBD::SQLite Data::Dumper));
 use_ok 'PublicInbox::NNTP';
 use_ok 'PublicInbox::Inbox';
 require_mods(qw(DBD::SQLite Data::Dumper));
 use_ok 'PublicInbox::NNTP';
 use_ok 'PublicInbox::Inbox';
@@ -107,7 +107,7 @@ use_ok 'PublicInbox::Inbox';
                                        url => [ '//example.com/a' ]});
        is($ng->base_url, $u, 'URL expanded');
        my $mid = 'a@b';
                                        url => [ '//example.com/a' ]});
        is($ng->base_url, $u, 'URL expanded');
        my $mid = 'a@b';
-       my $mime = PublicInbox::MIME->new("Message-ID: <$mid>\r\n\r\n");
+       my $mime = PublicInbox::Eml->new("Message-ID: <$mid>\r\n\r\n");
        my $hdr = $mime->header_obj;
        my $mock_self = { nntpd => { grouplist => [], 
                                     servername => 'example.com' } };
        my $hdr = $mime->header_obj;
        my $mock_self = { nntpd => { grouplist => [], 
                                     servername => 'example.com' } };
index 0ad29be0b82ea4c3e4826c83001533a7d527b271..3de219f157330eddd2775a78416c7e4121133035 100644 (file)
@@ -23,7 +23,7 @@ unless (-r $key && -r $cert) {
 use_ok 'PublicInbox::TLS';
 use_ok 'IO::Socket::SSL';
 require PublicInbox::InboxWritable;
 use_ok 'PublicInbox::TLS';
 use_ok 'IO::Socket::SSL';
 require PublicInbox::InboxWritable;
-require PublicInbox::MIME;
+require PublicInbox::Eml;
 require PublicInbox::SearchIdx;
 our $need_zlib;
 eval { require Compress::Raw::Zlib } or
 require PublicInbox::SearchIdx;
 our $need_zlib;
 eval { require Compress::Raw::Zlib } or
@@ -63,7 +63,7 @@ EOF
 
 {
        my $im = $ibx->importer(0);
 
 {
        my $im = $ibx->importer(0);
-       my $mime = mime_load 't/data/0001.patch';
+       my $mime = eml_load 't/data/0001.patch';
        ok($im->add($mime), 'message added');
        $im->done;
        if ($version == 1) {
        ok($im->add($mime), 'message added');
        $im->done;
        if ($version == 1) {
index 4993b29fe3f55c38e7f1591d81c942f9ffa68568..69f72ce12163ef453f8171a3494b23b326b7cdf8 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -7,7 +7,7 @@ use PublicInbox::TestCommon;
 use PublicInbox::Spawn qw(which);
 require_mods(qw(DBD::SQLite));
 require PublicInbox::InboxWritable;
 use PublicInbox::Spawn qw(which);
 require_mods(qw(DBD::SQLite));
 require PublicInbox::InboxWritable;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use IO::Socket;
 use Socket qw(IPPROTO_TCP TCP_NODELAY);
 use Net::NNTP;
 use IO::Socket;
 use Socket qw(IPPROTO_TCP TCP_NODELAY);
 use Net::NNTP;
@@ -57,7 +57,7 @@ $ibx = PublicInbox::Inbox->new($ibx);
 
        # ensure successful message delivery
        {
 
        # ensure successful message delivery
        {
-               my $mime = PublicInbox::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 To: =?utf-8?Q?El=C3=A9anor?= <you\@example.com>
 From: =?utf-8?Q?El=C3=A9anor?= <me\@example.com>
 Cc: $addr
 To: =?utf-8?Q?El=C3=A9anor?= <you\@example.com>
 From: =?utf-8?Q?El=C3=A9anor?= <me\@example.com>
 Cc: $addr
@@ -241,7 +241,7 @@ EOF
                ok($date <= $t1, 'valid date before stop');
        }
        if ('leafnode interop') {
                ok($date <= $t1, 'valid date before stop');
        }
        if ('leafnode interop') {
-               my $for_leafnode = PublicInbox::MIME->new(<<"");
+               my $for_leafnode = PublicInbox::Eml->new(<<"");
 From: longheader\@example.com
 To: $addr
 Subject: none
 From: longheader\@example.com
 To: $addr
 Subject: none
index 03b1ee80e711d13dbe1000b4f7a9b27b2bc7c202..ccb60d525f6d4279f4a1060bc5f92824cd61cc8b 100644 (file)
@@ -14,7 +14,7 @@ my $git_dir = "$tmpdir/a.git";
        my $git = PublicInbox::Git->new($git_dir);
        my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
        $im->init_bare;
        my $git = PublicInbox::Git->new($git_dir);
        my $im = PublicInbox::Import->new($git, 'testbox', 'test@example');
        $im->init_bare;
-       $im->add(PublicInbox::MIME->new(<<'EOF'));
+       $im->add(PublicInbox::Eml->new(<<'EOF'));
 From: a@example.com
 To: b@example.com
 Subject: A subject line with a null =?iso-8859-1?q?=00?= see!
 From: a@example.com
 To: b@example.com
 Subject: A subject line with a null =?iso-8859-1?q?=00?= see!
index 4fff977352b567671bc562934ff8018bc0d98190..37a6b39486e06ea1e4fc575893c3de96e09bc7f1 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -31,7 +31,7 @@ my $git = PublicInbox::Git->new($inboxdir);
 my $im = PublicInbox::Import->new($git, 'test', $addr);
 # ensure successful message delivery
 {
 my $im = PublicInbox::Import->new($git, 'test', $addr);
 # ensure successful message delivery
 {
-       my $mime = PublicInbox::MIME->new(<<EOF);
+       my $mime = PublicInbox::Eml->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -50,15 +50,15 @@ EOF
        chomp @ls;
 
        # multipart with two text bodies
        chomp @ls;
 
        # multipart with two text bodies
-       $mime = mime_load 't/plack-2-txt-bodies.eml';
+       $mime = eml_load 't/plack-2-txt-bodies.eml';
        $im->add($mime);
 
        # multipart with attached patch + filename
        $im->add($mime);
 
        # multipart with attached patch + filename
-       $mime = mime_load 't/plack-attached-patch.eml';
+       $mime = eml_load 't/plack-attached-patch.eml';
        $im->add($mime);
 
        # multipart collapsed to single quoted-printable text/plain
        $im->add($mime);
 
        # multipart collapsed to single quoted-printable text/plain
-       $mime = mime_load 't/plack-qp.eml';
+       $mime = eml_load 't/plack-qp.eml';
        like($mime->body_raw, qr/hi =3D bye=/, 'our test used QP correctly');
        $im->add($mime);
 
        like($mime->body_raw, qr/hi =3D bye=/, 'our test used QP correctly');
        $im->add($mime);
 
@@ -77,7 +77,7 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
 :(
 EOF
        $crlf =~ s/\n/\r\n/sg;
 :(
 EOF
        $crlf =~ s/\n/\r\n/sg;
-       $im->add(PublicInbox::MIME->new($crlf));
+       $im->add(PublicInbox::Eml->new($crlf));
 
        $im->done;
 }
 
        $im->done;
 }
index a8fd31b1ab33423d3261d807a554e08a7d3baa66..11193e38163141cbfbb685fffe0588013ec654a3 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use Email::Simple;
+use PublicInbox::Eml;
 use PublicInbox::MDA;
 
 sub do_checks {
 use PublicInbox::MDA;
 
 sub do_checks {
@@ -27,7 +27,7 @@ sub do_checks {
 }
 
 {
 }
 
 {
-       my $s = Email::Simple->new(<<'EOF');
+       my $s = PublicInbox::Eml->new(<<'EOF');
 From: abc@example.com
 To: abc@example.com
 Cc: c@example.com, another-list@example.com
 From: abc@example.com
 To: abc@example.com
 Cc: c@example.com, another-list@example.com
@@ -43,7 +43,7 @@ EOF
 }
 
 {
 }
 
 {
-       do_checks(Email::Simple->new(<<'EOF'));
+       do_checks(PublicInbox::Eml->new(<<'EOF'));
 From: a@example.com
 To: b@example.com
 Cc: c@example.com
 From: a@example.com
 To: b@example.com
 Cc: c@example.com
@@ -57,7 +57,7 @@ EOF
 }
 
 {
 }
 
 {
-       do_checks(Email::Simple->new(<<'EOF'));
+       do_checks(PublicInbox::Eml->new(<<'EOF'));
 From: a@example.com
 To: b+plus@example.com
 Cc: John Doe <c@example.com>
 From: a@example.com
 To: b+plus@example.com
 Cc: John Doe <c@example.com>
@@ -72,7 +72,7 @@ EOF
 
 {
        my $recipient = 'b@example.com';
 
 {
        my $recipient = 'b@example.com';
-       my $s = Email::Simple->new(<<'EOF');
+       my $s = PublicInbox::Eml->new(<<'EOF');
 To: b@example.com
 Cc: c@example.com
 Content-Type: text/plain
 To: b@example.com
 Cc: c@example.com
 Content-Type: text/plain
index af0fbdd397727db319759e3906825906dc4577e7..9a2b241164a294d8b3de0a846a61ada42592c84c 100644 (file)
@@ -29,7 +29,7 @@ $im->init_bare;
        my $b64 = "b64\xde\xad\xbe\xef\n";
        my $txt = "plain\ntext\npass\nthrough\n";
        my $dot = "dotfile\n";
        my $b64 = "b64\xde\xad\xbe\xef\n";
        my $txt = "plain\ntext\npass\nthrough\n";
        my $dot = "dotfile\n";
-       $im->add(mime_load('t/psgi_attach.eml'));
+       $im->add(eml_load('t/psgi_attach.eml'));
        $im->done;
 
        my $www = PublicInbox::WWW->new($config);
        $im->done;
 
        my $www = PublicInbox::WWW->new($config);
index 43025a4d5480a4332d603c557e3934dbaa0083f3..81bd9356c56fc5c570b46a35bb66cff29a56899f 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(DBD::SQLite HTTP::Request::Common Plack::Test
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(DBD::SQLite HTTP::Request::Common Plack::Test
@@ -45,7 +45,7 @@ To: b\@example.com
 Date: Fri, 02 Oct 1993 00:00:0$i +0000
 
 
 Date: Fri, 02 Oct 1993 00:00:0$i +0000
 
 
-       my $mime = PublicInbox::MIME->new(\$data);
+       my $mime = PublicInbox::Eml->new(\$data);
        ok($im->add($mime), "added $mid");
        $i++
 }
        ok($im->add($mime), "added $mid");
        $i++
 }
index bd492dcb2ac372a2aec0720e3caa26339f2a1dae..b4de827406b70a62c279454e73e882e617d9ec32 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $maindir = "$tmpdir/main.git";
 use PublicInbox::TestCommon;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $maindir = "$tmpdir/main.git";
@@ -25,7 +25,7 @@ my $git = PublicInbox::Git->new($maindir);
 my $im = PublicInbox::Import->new($git, 'test', $addr);
 $im->init_bare;
 {
 my $im = PublicInbox::Import->new($git, 'test', $addr);
 $im->init_bare;
 {
-       my $mime = PublicInbox::MIME->new(<<EOF);
+       my $mime = PublicInbox::Eml->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
index ef86c015f29143a27d45c0d1ac95285788d97406..e36820f4a3a39ebf93a9b6b348ff342f8af78d79 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
@@ -22,7 +22,7 @@ my $ibx = PublicInbox::Inbox->new({
 my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
 my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
 To: linux-kernel@vger.kernel.org
 Subject: [OSDL] linux-2.6.0-test3 reaim results
 Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
 To: linux-kernel@vger.kernel.org
 Subject: [OSDL] linux-2.6.0-test3 reaim results
index 93603a332819a4a9dc62287ff74a429483762cb3..46eb489f1ab0287737511c1619bbd3c7d6d1aa55 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite);
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite);
@@ -31,7 +31,7 @@ foreach my $i (1..2) {
        my $im = PublicInbox::V2Writable->new($ibx, 1);
        $im->{parallel} = 0;
        $im->init_inbox(0);
        my $im = PublicInbox::V2Writable->new($ibx, 1);
        $im->{parallel} = 0;
        $im->init_inbox(0);
-       my $mime = PublicInbox::MIME->new(<<EOF);
+       my $mime = PublicInbox::Eml->new(<<EOF);
 From: a\@example.com
 To: $addr
 Subject: s$i
 From: a\@example.com
 To: $addr
 Subject: s$i
index 3c515d19b67a11c218bb6d347eece293d0457fb9..64f8b1ac5c8378f6ce88a783f8bdcc86369efbd6 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::Inbox;
 use PublicInbox::InboxWritable;
 use PublicInbox::Config;
 use PublicInbox::Inbox;
 use PublicInbox::InboxWritable;
@@ -27,7 +27,7 @@ my $im = $ibx->importer(0);
 my $digits = '10010260936330';
 my $ua = 'Pine.LNX.4.10';
 my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
 my $digits = '10010260936330';
 my $ua = 'Pine.LNX.4.10';
 my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
-my $mime = PublicInbox::MIME->new(<<EOF);
+my $mime = PublicInbox::Eml->new(<<EOF);
 Subject: test
 Message-ID: <$mid>
 From: Ã†var Arnfjörð Bjarmason <avarab\@example>
 Subject: test
 Message-ID: <$mid>
 From: Ã†var Arnfjörð Bjarmason <avarab\@example>
@@ -36,7 +36,7 @@ To: git\@vger.kernel.org
 EOF
 $im->add($mime);
 
 EOF
 $im->add($mime);
 
-$mime = PublicInbox::MIME->new(<<'EOF');
+$mime = PublicInbox::Eml->new(<<'EOF');
 Subject:
 Message-ID: <blank-subject@example.com>
 From: blank subject <blank-subject@example.com>
 Subject:
 Message-ID: <blank-subject@example.com>
 From: blank subject <blank-subject@example.com>
@@ -45,7 +45,7 @@ To: git@vger.kernel.org
 EOF
 $im->add($mime);
 
 EOF
 $im->add($mime);
 
-$mime = PublicInbox::MIME->new(<<'EOF');
+$mime = PublicInbox::Eml->new(<<'EOF');
 Message-ID: <no-subject-at-all@example.com>
 From: no subject at all <no-subject-at-all@example.com>
 To: git@vger.kernel.org
 Message-ID: <no-subject-at-all@example.com>
 From: no subject at all <no-subject-at-all@example.com>
 To: git@vger.kernel.org
index b7b5b2d456e1580c6576efe8d35175f99a39bdee..833bcaba777c32638c1e816d15a58e755192e100 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $maindir = "$tmpdir/main.git";
 use PublicInbox::TestCommon;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $maindir = "$tmpdir/main.git";
index 9c19b0413dd1f0c20b61e58ea21c751006b88c9f..8f75a3fbf1958efa5d412f8cc6dee6c503136a8d 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 require_git(2.6);
 use Test::More;
 use PublicInbox::TestCommon;
 require_git(2.6);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::MID qw(mids);
 require_mods(qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test
 use PublicInbox::Config;
 use PublicInbox::MID qw(mids);
 require_mods(qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test
@@ -26,7 +26,7 @@ my $new_mid;
 my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
 my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From oldbug-pre-a0c07cba0e5d8b6a Fri Oct  2 00:00:00 1993
 From: a@example.com
 To: test@example.com
 From oldbug-pre-a0c07cba0e5d8b6a Fri Oct  2 00:00:00 1993
 From: a@example.com
 To: test@example.com
@@ -225,7 +225,7 @@ test_psgi(sub { $www->call(@_) }, sub {
 
        # ensure conflicted attachments can be resolved
        foreach my $body (qw(old new)) {
 
        # ensure conflicted attachments can be resolved
        foreach my $body (qw(old new)) {
-               $mime = mime_load "t/psgi_v2-$body.eml";
+               $mime = eml_load "t/psgi_v2-$body.eml";
                ok($im->add($mime), "added attachment $body");
        }
        $im->done;
                ok($im->add($mime), "added attachment $body");
        }
        $im->done;
index dcc440390e826f5e04cfd81565610353c9c2e668..2ca9edca73cbfda0f0d51e19b24f696728cef44e 100644 (file)
--- a/t/purge.t
+++ b/t/purge.t
@@ -36,7 +36,7 @@ local $ENV{PI_CONFIG} = $cfgfile;
 open my $cfg_fh, '>', $cfgfile or die "open: $!";
 
 my $v2w = PublicInbox::V2Writable->new($ibx, {nproc => 1});
 open my $cfg_fh, '>', $cfgfile or die "open: $!";
 
 my $v2w = PublicInbox::V2Writable->new($ibx, {nproc => 1});
-my $mime = PublicInbox::MIME->new($raw);
+my $mime = PublicInbox::Eml->new($raw);
 ok($v2w->add($mime), 'add message to be purged');
 $v2w->done;
 
 ok($v2w->add($mime), 'add message to be purged');
 $v2w->done;
 
index 2efa25f1457e685c7557477331694c88254cedb1..cef4e7aa6cbe6e57ebaed2c5998a436f62b43f38 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::InboxWritable;
 use PublicInbox::TestCommon;
 use Cwd qw(abs_path);
 use PublicInbox::InboxWritable;
 use PublicInbox::TestCommon;
 use Cwd qw(abs_path);
@@ -24,7 +24,7 @@ sub test_replace ($$$) {
                indexlevel => $level,
        });
 
                indexlevel => $level,
        });
 
-       my $orig = PublicInbox::MIME->new(<<'EOF');
+       my $orig = PublicInbox::Eml->new(<<'EOF');
 From: Barbra Streisand <effect@example.com>
 To: test@example.com
 Subject: confidential
 From: Barbra Streisand <effect@example.com>
 To: test@example.com
 Subject: confidential
@@ -49,7 +49,7 @@ EOF
        my $thread_a = $ibx->over->get_thread('replace@example.com');
 
        my %before = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
        my $thread_a = $ibx->over->get_thread('replace@example.com');
 
        my %before = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
-       my $reject = PublicInbox::MIME->new($orig->as_string);
+       my $reject = PublicInbox::Eml->new($orig->as_string);
        foreach my $mid (['<replace@example.com>', '<extra@example.com>'],
                                [], ['<replaced@example.com>']) {
                $reject->header_set('Message-ID', @$mid);
        foreach my $mid (['<replace@example.com>', '<extra@example.com>'],
                                [], ['<replaced@example.com>']) {
                $reject->header_set('Message-ID', @$mid);
@@ -61,7 +61,7 @@ EOF
 
        # prepare the replacement
        my $expect = "Move along, nothing to see here\n";
 
        # prepare the replacement
        my $expect = "Move along, nothing to see here\n";
-       my $repl = PublicInbox::MIME->new($orig->as_string);
+       my $repl = PublicInbox::Eml->new($orig->as_string);
        $repl->header_set('From', '<redactor@example.com>');
        $repl->header_set('Subject', 'redacted');
        $repl->header_set('Date', 'Sat, 02 Oct 2010 00:00:00 +0000');
        $repl->header_set('From', '<redactor@example.com>');
        $repl->header_set('Subject', 'redacted');
        $repl->header_set('Date', 'Sat, 02 Oct 2010 00:00:00 +0000');
@@ -80,7 +80,7 @@ EOF
        is($changed_epochs, 1, 'only one epoch changed');
 
        $im->done;
        is($changed_epochs, 1, 'only one epoch changed');
 
        $im->done;
-       my $m = PublicInbox::MIME->new($ibx->msg_by_mid('replace@example.com'));
+       my $m = PublicInbox::Eml->new($ibx->msg_by_mid('replace@example.com'));
        is($m->body, $expect, 'replaced message');
        is_deeply(\@warn, [], 'no warnings on noop');
 
        is($m->body, $expect, 'replaced message');
        is_deeply(\@warn, [], 'no warnings on noop');
 
@@ -159,7 +159,7 @@ sub pad_msgs {
                        ($i, $irt) = each %$i;
                }
                my $sec = sprintf('%0d', $i);
                        ($i, $irt) = each %$i;
                }
                my $sec = sprintf('%0d', $i);
-               my $mime = PublicInbox::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 From: foo\@example.com
 To: test\@example.com
 Message-ID: <$i\@example.com>
 From: foo\@example.com
 To: test\@example.com
 Message-ID: <$i\@example.com>
index a6c38cfaaf2ba97cc4929994b930fbc2bab553cd..53162df5d2566be1097745890cac339d6e866124 100644 (file)
--- a/t/reply.t
+++ b/t/reply.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use_ok 'PublicInbox::Reply';
 
 my @q = (
 use_ok 'PublicInbox::Reply';
 
 my @q = (
@@ -19,7 +19,7 @@ while (@q) {
        is($res, $expect, "quote $input => $res");
 }
 
        is($res, $expect, "quote $input => $res");
 }
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: from <from@example.com>
 To: to <to@example.com>
 Cc: cc@example.com
 From: from <from@example.com>
 To: to <to@example.com>
 Cc: cc@example.com
index 1bea59fd87ae35c4988f4444fe1ff19cbaff3857..914807a843f4fb94ca370afb0180f8a255a25e1b 100644 (file)
@@ -6,7 +6,7 @@ use bytes (); # only for bytes::length
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::MID qw(mids);
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::MID qw(mids);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 require PublicInbox::Smsg;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 require PublicInbox::Smsg;
@@ -42,7 +42,7 @@ my @mids;
 
 foreach (reverse split(/\n\n/, $data)) {
        $_ .= "\n";
 
 foreach (reverse split(/\n\n/, $data)) {
        $_ .= "\n";
-       my $mime = PublicInbox::MIME->new(\$_);
+       my $mime = PublicInbox::Eml->new(\$_);
        $mime->header_set('From' => 'bw@g');
        $mime->header_set('To' => 'git@vger.kernel.org');
        my $bytes = bytes::length($mime->as_string);
        $mime->header_set('From' => 'bw@g');
        $mime->header_set('To' => 'git@vger.kernel.org');
        my $bytes = bytes::length($mime->as_string);
@@ -78,7 +78,7 @@ $rw->commit_txn_lazy;
 
 $xdb = $rw->begin_txn_lazy;
 {
 
 $xdb = $rw->begin_txn_lazy;
 {
-       my $mime = PublicInbox::MIME->new(<<'');
+       my $mime = PublicInbox::Eml->new(<<'');
 Subject: [RFC 00/14]
 Message-Id: <1-bw@g>
 From: bw@g
 Subject: [RFC 00/14]
 Message-Id: <1-bw@g>
 From: bw@g
index 92f3305d556c5773fadc1e64f6e9f544904ff06f..6dd5047454aa48336895d72d843e22da8ec3ae38 100644 (file)
@@ -8,7 +8,7 @@ require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 require PublicInbox::Inbox;
 require PublicInbox::InboxWritable;
 require PublicInbox::SearchIdx;
 require PublicInbox::Inbox;
 require PublicInbox::InboxWritable;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/a.git";
 my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir });
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/a.git";
 my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir });
@@ -60,7 +60,7 @@ sub oct_is ($$$) {
 }
 
 $ibx->with_umask(sub {
 }
 
 $ibx->with_umask(sub {
-       my $root = PublicInbox::MIME->new(<<'EOF');
+       my $root = PublicInbox::Eml->new(<<'EOF');
 Date: Fri, 02 Oct 1993 00:00:00 +0000
 Subject: Hello world
 Message-ID: <root@s>
 Date: Fri, 02 Oct 1993 00:00:00 +0000
 Subject: Hello world
 Message-ID: <root@s>
@@ -70,7 +70,7 @@ List-Id: I'm not mad <i.m.just.bored>
 
 \m/
 EOF
 
 \m/
 EOF
-       my $last = PublicInbox::MIME->new(<<'EOF');
+       my $last = PublicInbox::Eml->new(<<'EOF');
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: Re: Hello world
 In-Reply-To: <root@s>
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: Re: Hello world
 In-Reply-To: <root@s>
@@ -128,7 +128,7 @@ sub filter_mids {
 $ibx->with_umask(sub {
        $rw_commit->();
        my $rmid = '<ghost-message@s>';
 $ibx->with_umask(sub {
        $rw_commit->();
        my $rmid = '<ghost-message@s>';
-       my $reply_to_ghost = PublicInbox::MIME->new(<<"EOF");
+       my $reply_to_ghost = PublicInbox::Eml->new(<<"EOF");
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: Re: ghosts
 Message-ID: <ghost-reply\@s>
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: Re: ghosts
 Message-ID: <ghost-reply\@s>
@@ -142,7 +142,7 @@ EOF
        my $reply_id = $rw->add_message($reply_to_ghost);
        is($reply_id, int($reply_id), "reply_id is an integer: $reply_id");
 
        my $reply_id = $rw->add_message($reply_to_ghost);
        is($reply_id, int($reply_id), "reply_id is an integer: $reply_id");
 
-       my $was_ghost = PublicInbox::MIME->new(<<"EOF");
+       my $was_ghost = PublicInbox::Eml->new(<<"EOF");
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Subject: ghosts
 Message-ID: $rmid
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Subject: ghosts
 Message-ID: $rmid
@@ -191,7 +191,7 @@ $ibx->with_umask(sub {
        $rw_commit->();
        $ro->reopen;
        my $long_mid = 'last' . ('x' x 60). '@s';
        $rw_commit->();
        $ro->reopen;
        my $long_mid = 'last' . ('x' x 60). '@s';
-       my $long = PublicInbox::MIME->new(<<EOF);
+       my $long = PublicInbox::Eml->new(<<EOF);
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: long message ID
 References: <root\@s> <last\@s>
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Subject: long message ID
 References: <root\@s> <last\@s>
@@ -211,7 +211,7 @@ EOF
        my @res;
 
        my $long_reply_mid = 'reply-to-long@1';
        my @res;
 
        my $long_reply_mid = 'reply-to-long@1';
-       my $long_reply = PublicInbox::MIME->new(<<EOF);
+       my $long_reply = PublicInbox::Eml->new(<<EOF);
 Subject: I break references
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Message-ID: <$long_reply_mid>
 Subject: I break references
 Date: Sat, 02 Oct 2010 00:00:00 +0000
 Message-ID: <$long_reply_mid>
@@ -235,7 +235,7 @@ EOF
 # quote prioritization
 $ibx->with_umask(sub {
        $rw_commit->();
 # quote prioritization
 $ibx->with_umask(sub {
        $rw_commit->();
-       $rw->add_message(PublicInbox::MIME->new(<<'EOF'));
+       $rw->add_message(PublicInbox::Eml->new(<<'EOF'));
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Subject: Hello
 Message-ID: <quote@a>
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Subject: Hello
 Message-ID: <quote@a>
@@ -245,7 +245,7 @@ To: list@example.com
 > theatre illusions
 fade
 EOF
 > theatre illusions
 fade
 EOF
-       $rw->add_message(PublicInbox::MIME->new(<<'EOF'));
+       $rw->add_message(PublicInbox::Eml->new(<<'EOF'));
 Date: Sat, 02 Oct 2010 00:00:02 +0000
 Subject: Hello
 Message-ID: <nquote@a>
 Date: Sat, 02 Oct 2010 00:00:02 +0000
 Subject: Hello
 Message-ID: <nquote@a>
@@ -269,7 +269,7 @@ EOF
 # circular references
 $ibx->with_umask(sub {
        my $s = 'foo://'. ('Circle' x 15).'/foo';
 # circular references
 $ibx->with_umask(sub {
        my $s = 'foo://'. ('Circle' x 15).'/foo';
-       my $doc_id = $rw->add_message(PublicInbox::MIME->new(<<EOF));
+       my $doc_id = $rw->add_message(PublicInbox::Eml->new(<<EOF));
 Subject: $s
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Message-ID: <circle\@a>
 Subject: $s
 Date: Sat, 02 Oct 2010 00:00:01 +0000
 Message-ID: <circle\@a>
@@ -288,7 +288,7 @@ EOF
 });
 
 $ibx->with_umask(sub {
 });
 
 $ibx->with_umask(sub {
-       my $mime = mime_load 't/utf8.eml';
+       my $mime = eml_load 't/utf8.eml';
        my $doc_id = $rw->add_message($mime);
        ok($doc_id > 0, 'message indexed doc_id with UTF-8');
        my $msg = $rw->query('m:testmessage@example.com', {limit => 1})->[0];
        my $doc_id = $rw->add_message($mime);
        ok($doc_id > 0, 'message indexed doc_id with UTF-8');
        my $msg = $rw->query('m:testmessage@example.com', {limit => 1})->[0];
@@ -371,7 +371,7 @@ $ibx->with_umask(sub {
 }
 
 $ibx->with_umask(sub {
 }
 
 $ibx->with_umask(sub {
-       my $amsg = mime_load 't/search-amsg.eml';
+       my $amsg = eml_load 't/search-amsg.eml';
        ok($rw->add_message($amsg), 'added attachment');
        $rw_commit->();
        $ro->reopen;
        ok($rw->add_message($amsg), 'added attachment');
        $rw_commit->();
        $ro->reopen;
@@ -429,7 +429,7 @@ $ibx->with_umask(sub {
        my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
        is($ro->reopen->query("m:$digits", { mset => 1})->size, 0,
                'no results yet');
        my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
        is($ro->reopen->query("m:$digits", { mset => 1})->size, 0,
                'no results yet');
-       my $pine = PublicInbox::MIME->new(<<EOF);
+       my $pine = PublicInbox::Eml->new(<<EOF);
 Subject: blah
 Message-ID: <$mid>
 From: torvalds\@transmeta
 Subject: blah
 Message-ID: <$mid>
 From: torvalds\@transmeta
index c483aba176a1fdd7b398cbe0eeb173a4d41129cd..78cc0edde0d29e9ac75bc4958f52bc090acae4ff 100644 (file)
@@ -15,7 +15,7 @@ chomp $git_dir;
 # needed for alternates, and --absolute-git-dir is only in git 2.13+
 $git_dir = abs_path($git_dir);
 
 # needed for alternates, and --absolute-git-dir is only in git 2.13+
 $git_dir = abs_path($git_dir);
 
-use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit WWW));
+use_ok "PublicInbox::$_" for (qw(Inbox V2Writable Git SolverGit WWW));
 
 my ($inboxdir, $for_destroy) = tmpdir();
 my $opts = {
 
 my ($inboxdir, $for_destroy) = tmpdir();
 my $opts = {
@@ -29,7 +29,7 @@ my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
 my $deliver_patch = sub ($) {
 $im->{parallel} = 0;
 
 my $deliver_patch = sub ($) {
-       $im->add(mime_load($_[0]));
+       $im->add(eml_load($_[0]));
        $im->done;
 };
 
        $im->done;
 };
 
index edfacc62ddef895f0e240dc6347b707f7985ad08..2d9da63101e7f5b0153672599279f031d73e23b6 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use Email::Simple;
+use PublicInbox::Eml;
 use IO::File;
 use Fcntl qw(:DEFAULT SEEK_SET);
 use PublicInbox::TestCommon;
 use IO::File;
 use Fcntl qw(:DEFAULT SEEK_SET);
 use PublicInbox::TestCommon;
@@ -28,19 +28,19 @@ Subject: test
 Message-ID: <testmessage@example.com>
 
 EOF
 Message-ID: <testmessage@example.com>
 
 EOF
-ok($spamc->spamcheck(Email::Simple->new($src), \$dst), 'Email::Simple works');
+ok($spamc->spamcheck(PublicInbox::Eml->new($src), \$dst), 'PublicInbox::Eml works');
 is($dst, $src, 'input == output');
 
 $dst = '';
 $spamc->{checkcmd} = ['sh', '-c', 'cat; false'];
 is($dst, $src, 'input == output');
 
 $dst = '';
 $spamc->{checkcmd} = ['sh', '-c', 'cat; false'];
-ok(!$spamc->spamcheck(Email::Simple->new($src), \$dst), 'Failed check works');
+ok(!$spamc->spamcheck(PublicInbox::Eml->new($src), \$dst), 'Failed check works');
 is($dst, $src, 'input == output for spammy example');
 
 for my $l (qw(ham spam)) {
        my $file = "$tmpdir/$l.out";
        $spamc->{$l.'cmd'} = ['tee', $file ];
        my $method = $l.'learn';
 is($dst, $src, 'input == output for spammy example');
 
 for my $l (qw(ham spam)) {
        my $file = "$tmpdir/$l.out";
        $spamc->{$l.'cmd'} = ['tee', $file ];
        my $method = $l.'learn';
-       ok($spamc->$method(Email::Simple->new($src)), "$method OK");
+       ok($spamc->$method(PublicInbox::Eml->new($src)), "$method OK");
        open my $fh, '<', $file or die "failed to open $file: $!";
        is(eval { local $/, <$fh> }, $src, "$l command ran alright");
 }
        open my $fh, '<', $file or die "failed to open $file: $!";
        is(eval { local $/, <$fh> }, $src, "$l command ran alright");
 }
index d6545c6df9955104ef930cc1f0ea5fd7dc29b79b..484ea443c9b1fabc30d2c2bbfb164aa026e2c0e3 100644 (file)
@@ -3,8 +3,9 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
+use PublicInbox::TestCommon;
+require_mods 'Email::Simple';
 use_ok('PublicInbox::SearchThread');
 use_ok('PublicInbox::SearchThread');
-use Email::Simple;
 my $mt = eval {
        require Mail::Thread;
        no warnings 'once';
 my $mt = eval {
        require Mail::Thread;
        no warnings 'once';
index 71600b93b60114e78e1a9debc4f47913881f9c74..b491711def65343eea8f0db73780909ddb527aa3 100644 (file)
--- a/t/time.t
+++ b/t/time.t
@@ -4,9 +4,9 @@ use strict;
 use warnings;
 use Test::More;
 use POSIX qw(strftime);
 use warnings;
 use Test::More;
 use POSIX qw(strftime);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::MsgTime qw(msg_datestamp);
 use PublicInbox::MsgTime qw(msg_datestamp);
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
 From: a@example.com
 To: b@example.com
 Subject: this is a subject
index 23f4fb1181becc7f0a018cba8a5845da585ebc7a..2cd45f608e93b9c4a73a5d91e822db7a402cd4ce 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Test::More;
 use PublicInbox::Import;
 use PublicInbox::TestCommon;
 use Test::More;
 use PublicInbox::Import;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 my ($inboxdir, $for_destroy) = tmpdir();
 require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
 my ($inboxdir, $for_destroy) = tmpdir();
@@ -15,7 +15,7 @@ my $ibx = {
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
index e473fe7c3942a95f2db6dbca31b10a0d6d733243..13605f8bd6ce5de1915fe7bc58b1a03756377486 100644 (file)
@@ -6,7 +6,7 @@ use Test::More;
 use PublicInbox::ContentId qw(content_digest);
 use File::Path qw(remove_tree);
 use PublicInbox::TestCommon;
 use PublicInbox::ContentId qw(content_digest);
 use File::Path qw(remove_tree);
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::SearchIdx';
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::SearchIdx';
@@ -18,7 +18,7 @@ my $ibx_config = {
        -primary_address => 'test@example.com',
        indexlevel => 'full',
 };
        -primary_address => 'test@example.com',
        indexlevel => 'full',
 };
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
index 60a869eeb9d2462eeafdb21a431b96d27f5541ba..cfdc8cf1ddbfc980fc0d3ebb8318c09281c9d33d 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::TestCommon;
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
 use PublicInbox::TestCommon;
 require_git(2.6);
 require_mods(qw(DBD::SQLite Search::Xapian));
@@ -16,7 +16,7 @@ my $ibx = {
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
index 4d3ec30db91e4b99ac076826841d53e3e81a2ba0..36f43ff096c09c58e8df91e1e3053f2ac8b924e0 100644 (file)
--- a/t/v2mda.t
+++ b/t/v2mda.t
@@ -6,7 +6,7 @@ use Test::More;
 use Fcntl qw(SEEK_SET);
 use Cwd;
 use PublicInbox::TestCommon;
 use Fcntl qw(SEEK_SET);
 use Cwd;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 require_git(2.6);
 
 my $V = 2;
 require_git(2.6);
 
 my $V = 2;
@@ -18,7 +18,7 @@ my $ibx = {
        name => 'test-v2writable',
        address => [ 'test@example.com' ],
 };
        name => 'test-v2writable',
        address => [ 'test@example.com' ],
 };
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
index ecf968912f6eb768a4edfa5630661bbdf23e44a2..d588808d645bc3a22410729d2ac273ae70292b49 100644 (file)
@@ -15,7 +15,7 @@ use IO::Socket;
 use POSIX qw(dup2);
 use_ok 'PublicInbox::V2Writable';
 use PublicInbox::InboxWritable;
 use POSIX qw(dup2);
 use_ok 'PublicInbox::V2Writable';
 use PublicInbox::InboxWritable;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 # FIXME: too much setup
 my ($tmpdir, $for_destroy) = tmpdir();
 use PublicInbox::Config;
 # FIXME: too much setup
 my ($tmpdir, $for_destroy) = tmpdir();
@@ -38,7 +38,7 @@ $ibx->{version} = 2;
 my $v2w = PublicInbox::V2Writable->new($ibx, 1);
 ok $v2w, 'v2w loaded';
 $v2w->{parallel} = 0;
 my $v2w = PublicInbox::V2Writable->new($ibx, 1);
 ok $v2w, 'v2w loaded';
 $v2w->{parallel} = 0;
-my $mime = PublicInbox::MIME->new(<<'');
+my $mime = PublicInbox::Eml->new(<<'');
 From: Me <me@example.com>
 To: You <you@example.com>
 Subject: a
 From: Me <me@example.com>
 To: You <you@example.com>
 Subject: a
index b97c6498c27b085c029b792392e10c5181b422a3..f16a0b0d81c341c3da60ffe65c9529eddb5bfd6a 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::ContentId qw(content_digest);
 use File::Path qw(remove_tree);
 use PublicInbox::TestCommon;
 use PublicInbox::ContentId qw(content_digest);
 use File::Path qw(remove_tree);
 use PublicInbox::TestCommon;
@@ -24,7 +24,7 @@ my $agpl = do {
        <$fh>;
 };
 my $phrase = q("defending all users' freedom");
        <$fh>;
 };
 my $phrase = q("defending all users' freedom");
-my $mime = PublicInbox::MIME->new(<<'EOF'.$agpl);
+my $mime = PublicInbox::Eml->new(<<'EOF'.$agpl);
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
@@ -434,7 +434,7 @@ ok(!-d $xap, 'Xapian directories removed again');
        $config{indexlevel} = 'medium';
        my $ibx = PublicInbox::Inbox->new(\%config);
        my $im = PublicInbox::V2Writable->new($ibx);
        $config{indexlevel} = 'medium';
        my $ibx = PublicInbox::Inbox->new(\%config);
        my $im = PublicInbox::V2Writable->new($ibx);
-       my $m3 = PublicInbox::MIME->new(<<'EOF');
+       my $m3 = PublicInbox::Eml->new(<<'EOF');
 Date: Tue, 24 May 2016 14:34:22 -0700 (PDT)
 Message-Id: <20160524.143422.552507610109476444.d@example.com>
 To: t@example.com
 Date: Tue, 24 May 2016 14:34:22 -0700 (PDT)
 Message-Id: <20160524.143422.552507610109476444.d@example.com>
 To: t@example.com
@@ -465,7 +465,7 @@ Somehow we got a message with 3 sets of headers into one
 message, could've been something broken on the archiver side.
 EOF
 
 message, could've been something broken on the archiver side.
 EOF
 
-       my $m1 = PublicInbox::MIME->new(<<'EOF');
+       my $m1 = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: t@example.com
 Subject: [PATCH 12/13]
 From: a@example.com
 To: t@example.com
 Subject: [PATCH 12/13]
index 07687052c0b7fe4f99b9ab1e6fc1442de2e41e81..e5a565cea23fa0a2ecd93b8eea017359a31d2299 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More;
 use strict;
 use warnings;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::ContentId qw(content_digest content_id);
 use PublicInbox::TestCommon;
 use Cwd qw(abs_path);
 use PublicInbox::ContentId qw(content_digest content_id);
 use PublicInbox::TestCommon;
 use Cwd qw(abs_path);
@@ -20,7 +20,7 @@ my $ibx = {
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
        -primary_address => 'test@example.com',
 };
 $ibx = PublicInbox::Inbox->new($ibx);
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
@@ -63,7 +63,7 @@ if ('ensure git configs are correct') {
        @warn = ();
        $mime->header_set('Message-Id', '<a-mid@b>', '<c@d>');
        is($im->add($mime), undef, 'secondary MID ignored if first matches');
        @warn = ();
        $mime->header_set('Message-Id', '<a-mid@b>', '<c@d>');
        is($im->add($mime), undef, 'secondary MID ignored if first matches');
-       my $sec = PublicInbox::MIME->new($mime->as_string);
+       my $sec = PublicInbox::Eml->new($mime->as_string);
        $sec->header_set('Date');
        $sec->header_set('Message-Id', '<a-mid@b>', '<c@d>');
        ok($im->add($sec), 'secondary MID used if data is different');
        $sec->header_set('Date');
        $sec->header_set('Message-Id', '<a-mid@b>', '<c@d>');
        ok($im->add($sec), 'secondary MID used if data is different');
@@ -90,7 +90,7 @@ if ('ensure git configs are correct') {
        my $hdr = $mime->header_obj;
        my $gen = PublicInbox::Import::digest2mid(content_digest($mime), $hdr);
        unlike($gen, qr![\+/=]!, 'no URL-unfriendly chars in Message-Id');
        my $hdr = $mime->header_obj;
        my $gen = PublicInbox::Import::digest2mid(content_digest($mime), $hdr);
        unlike($gen, qr![\+/=]!, 'no URL-unfriendly chars in Message-Id');
-       my $fake = PublicInbox::MIME->new($mime->as_string);
+       my $fake = PublicInbox::Eml->new($mime->as_string);
        $fake->header_set('Message-Id', "<$gen>");
        ok($im->add($fake), 'fake added easily');
        is_deeply(\@warn, [], 'no warnings from a faker');
        $fake->header_set('Message-Id', "<$gen>");
        ok($im->add($fake), 'fake added easily');
        is_deeply(\@warn, [], 'no warnings from a faker');
index 09217d94fcfa368e1215ec0a53ad252d5f0cc440..2e7d402e5fafb45143c99cc522e95ec458807e86 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use PublicInbox::TestCommon;
 use Test::More;
 use warnings;
 use PublicInbox::TestCommon;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Config;
 require_mods(qw(Filesys::Notify::Simple DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::WatchMaildir';
 use PublicInbox::Config;
 require_mods(qw(Filesys::Notify::Simple DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::WatchMaildir';
index c34d15f799a6123d2e2429a0ca46d9c0027fbf53..66955072cd58dc412eeeb5936493207429b2c870 100644 (file)
@@ -2,7 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use Cwd;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 use Cwd;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
index dd5030ea0e89bfc4c0311f03e42212c43bfa8763..19a2da7707085b6d536472bd8fbf8525cfbd51d8 100644 (file)
@@ -2,7 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use Cwd;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 use Cwd;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
index a885c3897c6bbbd7735acc1e9206777d8dba6aea..337303d9fc45bc22164850c34afe175737abd7dc 100644 (file)
@@ -26,7 +26,7 @@ if ('setup') {
        my $ibx = PublicInbox::Inbox->new($opts);
        $ibx = PublicInbox::InboxWritable->new($ibx, 1);
        my $im = $ibx->importer(0);
        my $ibx = PublicInbox::Inbox->new($opts);
        $ibx = PublicInbox::InboxWritable->new($ibx, 1);
        my $im = $ibx->importer(0);
-       my $mime = PublicInbox::MIME->new(<<'EOF');
+       my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 Message-Id: <a@example.com>
 
 From: a@example.com
 Message-Id: <a@example.com>
 
index 0e1fea52d152a9415f502e97b7aeeae20579d28d..70012cc6f49ee9193816d660051076149235a415 100644 (file)
@@ -6,11 +6,11 @@ use Test::More;
 use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require_git('2.6');
 use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require_git('2.6');
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::InboxWritable;
 require PublicInbox::Search;
 
 use PublicInbox::InboxWritable;
 require PublicInbox::Search;
 
-my $mime = PublicInbox::MIME->new(<<'EOF');
+my $mime = PublicInbox::Eml->new(<<'EOF');
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
 From: a@example.com
 To: test@example.com
 Subject: this is a subject
index 4ebf5b2cedb85a859b771873452de3d92f95fb2b..95d7c64bec67a337eaccf44d5b4227d1925a2fad 100644 (file)
@@ -4,7 +4,7 @@
 use strict;
 use Test::More;
 use PublicInbox::TestCommon;
 use strict;
 use Test::More;
 use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::Inbox;
 use PublicInbox::Git;
 use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
 use PublicInbox::Inbox;
 use PublicInbox::Git;
 use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
@@ -48,7 +48,7 @@ sub quiet_is_deeply ($$$$$) {
 sub compare {
        my ($bref, $oid, $type, $size) = @_;
        local $SIG{__WARN__} = sub { diag "$oid: ", @_ };
 sub compare {
        my ($bref, $oid, $type, $size) = @_;
        local $SIG{__WARN__} = sub { diag "$oid: ", @_ };
-       my $mime = PublicInbox::MIME->new($$bref);
+       my $mime = PublicInbox::Eml->new($$bref);
        my $hdr = $mime->header_obj;
        my @cur = msg_datestamp($hdr);
        my @old = Old::msg_datestamp($hdr);
        my $hdr = $mime->header_obj;
        my @cur = msg_datestamp($hdr);
        my @old = Old::msg_datestamp($hdr);
@@ -116,7 +116,7 @@ sub time_response ($) {
 }
 
 sub msg_received_at ($) {
 }
 
 sub msg_received_at ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my @recvd = $hdr->header_raw('Received');
        my ($ts);
        foreach my $r (@recvd) {
        my @recvd = $hdr->header_raw('Received');
        my ($ts);
        foreach my $r (@recvd) {
@@ -131,7 +131,7 @@ sub msg_received_at ($) {
 }
 
 sub msg_date_only ($) {
 }
 
 sub msg_date_only ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my @date = $hdr->header_raw('Date');
        my ($ts);
        foreach my $d (@date) {
        my @date = $hdr->header_raw('Date');
        my ($ts);
        foreach my $d (@date) {
@@ -149,7 +149,7 @@ sub msg_date_only ($) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my $ret;
        $ret = msg_received_at($hdr) and return time_response($ret);
        $ret = msg_date_only($hdr) and return time_response($ret);
        my $ret;
        $ret = msg_received_at($hdr) and return time_response($ret);
        $ret = msg_date_only($hdr) and return time_response($ret);
@@ -158,7 +158,7 @@ sub msg_timestamp ($) {
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($) {
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($) {
-       my ($hdr) = @_; # Email::MIME::Header
+       my ($hdr) = @_; # PublicInbox::Eml
        my $ret;
        $ret = msg_date_only($hdr) and return time_response($ret);
        $ret = msg_received_at($hdr) and return time_response($ret);
        my $ret;
        $ret = msg_date_only($hdr) and return time_response($ret);
        $ret = msg_received_at($hdr) and return time_response($ret);
index a4445959406ae948ee0e124c003871c2b59cd23c..30fc07dcbc87ad812de8da9d41bb3df0bc1883e3 100644 (file)
@@ -38,7 +38,7 @@ my $obuf = '';
 my $m = 0;
 
 my $cb = sub {
 my $m = 0;
 
 my $cb = sub {
-       $mime = PublicInbox::MIME->new(shift);
+       $mime = PublicInbox::Eml->new(shift);
        PublicInbox::View::multipart_text_as_html($mime, $ctx);
        ++$m;
        $obuf = '';
        PublicInbox::View::multipart_text_as_html($mime, $ctx);
        ++$m;
        $obuf = '';