INSTALL | 26 ++++++++++++-------------- Makefile.PL | 5 ----- ci/deps.perl | 3 --- lib/PublicInbox/Import.pm | 8 ++++---- lib/PublicInbox/MIME.pm | 3 +++ lib/PublicInbox/MsgTime.pm | 8 ++++---- lib/PublicInbox/TestCommon.pm | 3 +-- t/altid.t | 4 ++-- t/altid_v2.t | 4 ++-- t/cgi.t | 8 ++++---- t/content_id.t | 6 +++--- t/convert-compact.t | 4 ++-- t/edit.t | 20 ++++++++++---------- t/feed.t | 6 +++--- t/filter_base.t | 4 ++-- t/filter_mirror.t | 2 +- t/filter_subjecttag.t | 4 ++-- t/filter_vger.t | 6 +++--- t/html_index.t | 4 ++-- t/httpd.t | 4 ++-- t/import.t | 4 ++-- t/indexlevels-mirror.t | 4 ++-- t/mda.t | 4 ++-- t/mda_filter_rubylang.t | 2 +- t/mid.t | 4 ++-- t/mime.t | 77 ++++++++++++++++++++++++++++++----------------------- t/msg_iter.t | 8 ++++---- t/msgtime.t | 6 +++--- t/multi-mid.t | 6 +++--- t/nntp.t | 4 ++-- t/nntpd-tls.t | 4 ++-- t/nntpd.t | 6 +++--- t/nulsubject.t | 2 +- t/plack.t | 10 +++++----- t/precheck.t | 10 +++++----- t/psgi_attach.t | 2 +- t/psgi_bad_mids.t | 4 ++-- t/psgi_mount.t | 4 ++-- t/psgi_multipart_not.t | 4 ++-- t/psgi_scan_all.t | 4 ++-- t/psgi_search.t | 8 ++++---- t/psgi_text.t | 2 +- t/psgi_v2.t | 6 +++--- t/purge.t | 2 +- t/replace.t | 12 ++++++------ t/reply.t | 4 ++-- t/search-thr-index.t | 6 +++--- t/search.t | 26 +++++++++++++------------- t/solver_git.t | 4 ++-- t/spamcheck_spamc.t | 8 ++++---- t/thread-cycle.t | 3 ++- t/time.t | 4 ++-- t/v1-add-remove-add.t | 4 ++-- t/v1reindex.t | 4 ++-- t/v2-add-remove-add.t | 4 ++-- t/v2mda.t | 4 ++-- t/v2mirror.t | 4 ++-- t/v2reindex.t | 8 ++++---- t/v2writable.t | 8 ++++---- t/watch_filter_rubylang.t | 2 +- t/watch_maildir.t | 2 +- t/watch_maildir_v2.t | 2 +- t/www_altid.t | 2 +- t/xcpdb-reshard.t | 4 ++-- xt/msgtime_cmp.t | 12 ++++++------ xt/perf-msgview.t | 2 +- diff --git a/INSTALL b/INSTALL index 2dd7dcff7013303091575e3c7e818a1fd50a6c8a..80cee7535f87c72ec8bdccb4382e09b89c5bbf7a 100644 --- a/INSTALL +++ b/INSTALL @@ -36,14 +36,17 @@ * 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) + +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: @@ -86,6 +89,11 @@ pkg: pkg-Inline-C (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 @@ -107,16 +115,6 @@ (optional, for public-inbox-compact(1)) 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 diff --git a/Makefile.PL b/Makefile.PL index 59345edb63f0c99dd999b6ccf29661ba577fe748..efbb59cbf939079f97bbb75eb04a2f7c40208295 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -122,11 +122,6 @@ # libperl$PERL_VERSION, # `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 diff --git a/ci/deps.perl b/ci/deps.perl index 06b4fbe0f2f3a0be7a939a94405fcf272528f9c1..48aaa9e46d49f4d1d3f0c760f101bef7ad805a0c 100755 --- a/ci/deps.perl +++ b/ci/deps.perl @@ -20,9 +20,6 @@ git perl Devel::Peek Digest::SHA - Email::Simple - Email::MIME - Email::MIME::ContentType Encode ExtUtils::MakeMaker IO::Compress::Gzip diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 98aa7785efb1815f985fffe56b70aad772bca206..07d1859920003ea820c8ccd70cb536acee9e2f74 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -213,13 +213,13 @@ $oid; } # 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 { - 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); @@ -375,7 +375,7 @@ # 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}; diff --git a/lib/PublicInbox/MIME.pm b/lib/PublicInbox/MIME.pm index b795b93b1054e93a43831e12b72d9683e63f99db..9077386ac2123fab3c28e57d7e8d65f239e9a48b 100644 --- a/lib/PublicInbox/MIME.pm +++ b/lib/PublicInbox/MIME.pm @@ -3,6 +3,9 @@ # it under the same terms as Perl itself. # # 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 at: # diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm index 920e8f8a4e7d81f9aec43b0177f39652854f0b60..8596f01c71de9d1b824b6a0d804135888db810db 100644 --- a/lib/PublicInbox/MsgTime.pm +++ b/lib/PublicInbox/MsgTime.pm @@ -138,7 +138,7 @@ wantarray ? @$ret : $ret->[0]; } 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) { @@ -153,7 +153,7 @@ undef; } 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) { @@ -168,7 +168,7 @@ } # 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); @@ -177,7 +177,7 @@ } # 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); diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 978c3cd7bafaf4a1cc82a7a78724296453f49cbd..d952ee6d97715fc644b1dcf0e663d977821c8413 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -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 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); @@ -23,7 +22,7 @@ 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> })); } diff --git a/t/altid.t b/t/altid.t index c7a3601a6b196f03f5111c11f89bb0b8e57f1528..670a39633755149c3260bb5c3b7470e1fabfeb3e 100644 --- a/t/altid.t +++ b/t/altid.t @@ -4,7 +4,7 @@ use strict; 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'; @@ -27,7 +27,7 @@ { 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! diff --git a/t/altid_v2.t b/t/altid_v2.t index 3ac294f05b3b005f9e2683b165d4daeb2d4db376..28a047d992eff345fe10d1c0dc85a72b1cf9b2a6 100644 --- a/t/altid_v2.t +++ b/t/altid_v2.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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)); @@ -31,7 +31,7 @@ altid => $altid, }; $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! diff --git a/t/cgi.t b/t/cgi.t index 42a343d3040f06303fb42a09cce5c22f6b07f65a..d1f971504efb43aaf26b2681087278f57460e5f4 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -5,7 +5,7 @@ # should be moved over to things which use test_psgi 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)); @@ -45,7 +45,7 @@ { local $ENV{HOME} = $home; # inject some messages: - my $mime = PublicInbox::MIME->new(<new(< To: You Cc: $addr @@ -62,7 +62,7 @@ $mime->body_str_set("z\n" x 1024); ok($im->add($mime), 'added big message'); # deliver a reply, too - $mime = PublicInbox::MIME->new(<new(< To: Me Cc: $addr @@ -79,7 +79,7 @@ EOF ok($im->add($mime), 'added reply'); my $slashy_mid = 'slashy/asdf@example.com'; - my $slashy = PublicInbox::MIME->new(<new(< To: Me Cc: $addr diff --git a/t/content_id.t b/t/content_id.t index 0325164df77de292075b2ec8c885e5642cf8a1b8..9df81aa829379e92f2027fdc1724b526789082c4 100644 --- a/t/content_id.t +++ b/t/content_id.t @@ -4,9 +4,9 @@ use strict; 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 @@ -17,7 +17,7 @@ hello world 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)) { diff --git a/t/convert-compact.t b/t/convert-compact.t index 1627e0195b5219cd73008cb5e5e87f678db25078..80efc19c79816a57cf7e6af3115e80caa63c0dda 100644 --- a/t/convert-compact.t +++ b/t/convert-compact.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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); @@ -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); -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 diff --git a/t/edit.t b/t/edit.t index d8833f9c64a1d01f2b81e72d809a692bfe3d75a8..1a5698f69231232f5783cbc606f814ed00ff355f 100644 --- 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); -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; @@ -41,7 +41,7 @@ $in = $out = $err = ''; 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"); } @@ -51,7 +51,7 @@ $in = $out = $err = ''; 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"); } @@ -63,7 +63,7 @@ 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 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"); @@ -79,7 +79,7 @@ local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Status: RO\\n\$&/'"; $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"); @@ -94,7 +94,7 @@ $in = $out = $err = ''; 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'); @@ -127,7 +127,7 @@ delete $ENV{MAIL_EDITOR}; 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'); } @@ -137,20 +137,20 @@ $in = $out = $err = ''; 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"); - $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"); - $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"); } diff --git a/t/feed.t b/t/feed.t index 373a1de825a72f647f4d25d818e6a58dfb0427db..5ad90a07c1c8c1bd0f346f661b7170567f473965 100644 --- a/t/feed.t +++ b/t/feed.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use PublicInbox::Feed; use PublicInbox::Import; use PublicInbox::Inbox; @@ -36,7 +36,7 @@ { $im->init_bare; foreach my $i (1..6) { - my $mime = PublicInbox::MIME->new(<new(< To: U Message-Id: <$i\@example.com> @@ -95,7 +95,7 @@ # add a new spam message my $spam; { - $spam = PublicInbox::MIME->new(<new(< To: U Message-Id: diff --git a/t/filter_base.t b/t/filter_base.t index bbd64189fb5fa2a2484d100bd6a3035708ecade0..47d0220f567ce3791c91f67dce900e43f3b2fa1d 100644 --- a/t/filter_base.t +++ b/t/filter_base.t @@ -21,13 +21,13 @@ } { 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; - 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'); } diff --git a/t/filter_mirror.t b/t/filter_mirror.t index 0e641a03ca61544a7abfacf8d238d3084acaaade..5bc7f3f406d8c29a0fdc50ef7ce2c45c35acc085 100644 --- a/t/filter_mirror.t +++ b/t/filter_mirror.t @@ -9,7 +9,7 @@ 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'); } diff --git a/t/filter_subjecttag.t b/t/filter_subjecttag.t index 9b397b8c2466e8fd44c04ebdbbff1b0fa5ae8b4f..75effa2769a5ad9052dc49b9e96d26c67f38514c 100644 --- a/t/filter_subjecttag.t +++ b/t/filter_subjecttag.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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 }; @@ -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'); -my $mime = PublicInbox::MIME->new(<new(< Subject: =?UTF-8?B?UmU6IFtmb29dIEVsw4PCqWFub3I=?= diff --git a/t/filter_vger.t b/t/filter_vger.t index 9d71f16d03c8463980f4742ad21f3be277d4be6d..ca5a6ca720871ee8596efa9093343fea63f2721a 100644 --- a/t/filter_vger.t +++ b/t/filter_vger.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; 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 - 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'); } @@ -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 - 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'); } diff --git a/t/html_index.t b/t/html_index.t index 51897532f26a3f71ceaf1d13ccbba70ff5536301..80f81577e2aee2d875a772678e26b665bc8ae877 100644 --- a/t/html_index.t +++ b/t/html_index.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use PublicInbox::Feed; use PublicInbox::Git; use PublicInbox::Import; @@ -32,7 +32,7 @@ if ($prev) { $mid_line .= "In-Reply-To: $prev"; } $prev = $mid; - my $mime = PublicInbox::MIME->new(<new(< To: U $mid_line diff --git a/t/httpd.t b/t/httpd.t index f4fbd5330be2e0b874c579216eeff56ed7f7f12c..7404eb8b691156a7f820eea4310c037e8d78684f 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -4,7 +4,7 @@ use strict; 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)); @@ -28,7 +28,7 @@ ok(run_script($cmd), 'init ran properly'); # ensure successful message delivery { - my $mime = PublicInbox::MIME->new(<new(< To: You Cc: $addr diff --git a/t/import.t b/t/import.t index ba4abd9cb321e0cba0c741ed8168285e590a56c6..3f308299148f4e20ff8b947fc17bc68b4808ecf6 100644 --- a/t/import.t +++ b/t/import.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use PublicInbox::Git; use PublicInbox::Import; use PublicInbox::Spawn qw(spawn); @@ -15,7 +15,7 @@ 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 diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index dcd5dc39128ec8f0f3884e1f458cd117062e13d2..704f7e1174e3198e6c0bb6e6b1fc5cc5c3a48fd6 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; 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)); -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 diff --git a/t/mda.t b/t/mda.t index 03cc4bc3c444cbd0531b524c553f3f4d05be98e5..759c0b020abc661addd2752787e9c95c62ea0b5c 100644 --- 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/; - 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); @@ -229,7 +229,7 @@ ok(run_script(['-learn', 'ham'], undef, { 0 => \$in }), "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; diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t index f2cbe9d59584a8c3b341d72057defc74ebd368ff..483fcb8554943bfcd664291180ced603307bc03c 100644 --- a/t/mda_filter_rubylang.t +++ b/t/mda_filter_rubylang.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use PublicInbox::Config; use PublicInbox::TestCommon; require_git(2.6); diff --git a/t/mid.t b/t/mid.t index 0ad81d7da8be71011bdb0cef047ecaec73519053..3b8f41087e570ee78319e4df7f09ae7139cd8dd6 100644 --- a/t/mid.t +++ b/t/mid.t @@ -2,7 +2,7 @@ # Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ 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)'); @@ -16,7 +16,7 @@ is(id_compress('foobar-wtf'), 'foobar-wtf', 'regular ID not compressed'); { - my $mime = PublicInbox::MIME->new("Message-ID: \n\n"); + my $mime = PublicInbox::Eml->new("Message-ID: \n\n"); $mime->header_set('X-Alt-Message-ID', ''); is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case'); $mime->header_set('Message-Id', '', ''); diff --git a/t/mime.t b/t/mime.t index b9a4d66b098cd2fde269576953c629ede97e8777..d17ec58e92dcbb42493f1d89e1291ada984c67cf 100644 --- a/t/mime.t +++ b/t/mime.t @@ -1,16 +1,23 @@ +#!perl -w # Copyright (C) 2017-2020 all contributors # This library is free software; you can redistribute it and/or modify # it under the same terms as Perl itself. # Artistic or GPL-1+ use strict; -use warnings; use Test::More; -use_ok 'PublicInbox::MIME'; +use PublicInbox::TestCommon; use PublicInbox::MsgIter; +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) -local $SIG{__WARN__} = sub {}; -my $msg = PublicInbox::MIME->new( -'From: Richard Hansen +for my $cls (@classes) { + my $msg = PublicInbox::MIME->new(<<'EOF'); +From: Richard Hansen To: git@vger.kernel.org Cc: Richard Hansen Subject: [PATCH 0/2] minor diff orderfile documentation improvements @@ -40,10 +47,11 @@ dkTlB69771K2eXK4LcHSH/2LqX+VYa3K44vrx1ruzjXdNWzIpKBy0weFNiwnJCGofvCysM2RCSI1 --94eb2c0bc864b76ba30545b2bca9-- -'); +EOF -my @parts = $msg->parts; -my $exp = 'Richard Hansen (2): + my @parts = $msg->parts; + my $exp = <isa('Email::MIME'), 'compatible with Email::MIME'); -is($parts[0]->body, $exp, 'body matches expected'); - + 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 To: Junio C Hamano Cc: git@vger.kernel.org, peff@peff.net, sunshine@sunshineco.com, @@ -92,28 +99,30 @@ -----END PGP SIGNATURE----- --r24xguofrazenjwe-- -^; +EOF -$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++; -}); + $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'); + is($nr, 2, 'got 2 parts'); + is($msg->as_string, $raw, + 'stringified sufficiently close to original'); +} done_testing(); diff --git a/t/msg_iter.t b/t/msg_iter.t index e8115e2584c7ba7a0ccf58fab7511a123e490eb0..4ee3a201c797f4570a5ca2a1e719f062b442a71c 100644 --- a/t/msg_iter.t +++ b/t/msg_iter.t @@ -8,7 +8,7 @@ use PublicInbox::Hval qw(ascii_html); 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]}; @@ -20,7 +20,7 @@ is_deeply(\@parts, [ [ qw(a 1 1) ], [ qw(b 1 2) ] ], 'order is fine'); } { - 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]}; @@ -33,7 +33,7 @@ 'nested part shows up properly'); } { - 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]}; @@ -46,7 +46,7 @@ is(index($raw, '$$$'), -1, 'no unescaped $$$'); } { - 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]}; diff --git a/t/msgtime.t b/t/msgtime.t index d9f8e6417d5bd3de73c636a5a1c2cf9327e7a0ec..89fd9e37b85a13ec87079b1a7eb0f5bff645ec34 100644 --- a/t/msgtime.t +++ b/t/msgtime.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; 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 - 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 @@ -30,7 +30,7 @@ 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 diff --git a/t/multi-mid.t b/t/multi-mid.t index 5afb96933209d3e5f7e306f073a4764e9ba26f4a..91c8597e2e61f1815f6f4976e4aa59365b266d46 100644 --- a/t/multi-mid.t +++ b/t/multi-mid.t @@ -2,7 +2,7 @@ # Copyright (C) 2020 all contributors # License: AGPL-3.0+ use strict; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; 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 $bad = PublicInbox::MIME->new(<new(< Message-ID: From: a\@example.com @@ -20,7 +20,7 @@ Subject: bad EOF -my $good = PublicInbox::MIME->new(<new(< From: b\@example.com To: $addr diff --git a/t/nntp.t b/t/nntp.t index 35fb55b42ccfec723a2dfa734222d8aedd648b9c..2a9f3a4f6ebdd2e69d58cffe4e3ccb4e6bfb019b 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -4,7 +4,7 @@ use strict; 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'; @@ -107,7 +107,7 @@ domain => 'example.com', 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' } }; diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t index 0ad29be0b82ea4c3e4826c83001533a7d527b271..3de219f157330eddd2775a78416c7e4121133035 100644 --- a/t/nntpd-tls.t +++ b/t/nntpd-tls.t @@ -23,7 +23,7 @@ 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 @@ -63,7 +63,7 @@ } { 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) { diff --git a/t/nntpd.t b/t/nntpd.t index 4993b29fe3f55c38e7f1591d81c942f9ffa68568..69f72ce12163ef453f8171a3494b23b326b7cdf8 100644 --- 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::MIME; +use PublicInbox::Eml; use IO::Socket; use Socket qw(IPPROTO_TCP TCP_NODELAY); use Net::NNTP; @@ -57,7 +57,7 @@ my $im = $ibx->importer; # ensure successful message delivery { - my $mime = PublicInbox::MIME->new(<new(< From: =?utf-8?Q?El=C3=A9anor?= Cc: $addr @@ -241,7 +241,7 @@ ok($date >= $t0, 'valid date after start'); 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 diff --git a/t/nulsubject.t b/t/nulsubject.t index 03b1ee80e711d13dbe1000b4f7a9b27b2bc7c202..ccb60d525f6d4279f4a1060bc5f92824cd61cc8b 100644 --- a/t/nulsubject.t +++ b/t/nulsubject.t @@ -14,7 +14,7 @@ { 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! diff --git a/t/plack.t b/t/plack.t index 4fff977352b567671bc562934ff8018bc0d98190..37a6b39486e06ea1e4fc575893c3de96e09bc7f1 100644 --- 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 $mime = PublicInbox::MIME->new(<new(< To: You Cc: $addr @@ -50,15 +50,15 @@ @ls = $git->qx(qw(ls-tree -r --name-only HEAD)); 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 - $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 - $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); @@ -77,7 +77,7 @@ :( EOF $crlf =~ s/\n/\r\n/sg; - $im->add(PublicInbox::MIME->new($crlf)); + $im->add(PublicInbox::Eml->new($crlf)); $im->done; } diff --git a/t/precheck.t b/t/precheck.t index a8fd31b1ab33423d3261d807a554e08a7d3baa66..11193e38163141cbfbb685fffe0588013ec654a3 100644 --- a/t/precheck.t +++ b/t/precheck.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::Simple; +use PublicInbox::Eml; use PublicInbox::MDA; sub do_checks { @@ -27,7 +27,7 @@ "alias list is OK"); } { - 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 @@ -43,7 +43,7 @@ ok(PublicInbox::MDA->precheck($s, $addr), 'Cc list is OK'); } { - do_checks(Email::Simple->new(<<'EOF')); + do_checks(PublicInbox::Eml->new(<<'EOF')); 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 @@ -72,7 +72,7 @@ } { 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 diff --git a/t/psgi_attach.t b/t/psgi_attach.t index af0fbdd397727db319759e3906825906dc4577e7..9a2b241164a294d8b3de0a846a61ada42592c84c 100644 --- a/t/psgi_attach.t +++ b/t/psgi_attach.t @@ -29,7 +29,7 @@ my $qp = "abcdef=g\n==blah\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); diff --git a/t/psgi_bad_mids.t b/t/psgi_bad_mids.t index 43025a4d5480a4332d603c557e3934dbaa0083f3..81bd9356c56fc5c570b46a35bb66cff29a56899f 100644 --- a/t/psgi_bad_mids.t +++ b/t/psgi_bad_mids.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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 @@ -45,7 +45,7 @@ To: b\@example.com 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++ } diff --git a/t/psgi_mount.t b/t/psgi_mount.t index bd492dcb2ac372a2aec0720e3caa26339f2a1dae..b4de827406b70a62c279454e73e882e617d9ec32 100644 --- a/t/psgi_mount.t +++ b/t/psgi_mount.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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"; @@ -25,7 +25,7 @@ my $git = PublicInbox::Git->new($maindir); my $im = PublicInbox::Import->new($git, 'test', $addr); $im->init_bare; { - my $mime = PublicInbox::MIME->new(<new(< To: You Cc: $addr diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t index ef86c015f29143a27d45c0d1ac95285788d97406..e36820f4a3a39ebf93a9b6b348ff342f8af78d79 100644 --- a/t/psgi_multipart_not.t +++ b/t/psgi_multipart_not.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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 @@ -22,7 +22,7 @@ }); 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 diff --git a/t/psgi_scan_all.t b/t/psgi_scan_all.t index 93603a332819a4a9dc62287ff74a429483762cb3..46eb489f1ab0287737511c1619bbd3c7d6d1aa55 100644 --- a/t/psgi_scan_all.t +++ b/t/psgi_scan_all.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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); @@ -31,7 +31,7 @@ my $ibx = PublicInbox::Inbox->new($opt); my $im = PublicInbox::V2Writable->new($ibx, 1); $im->{parallel} = 0; $im->init_inbox(0); - my $mime = PublicInbox::MIME->new(<new(< use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; 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 $mime = PublicInbox::MIME->new(<new(< From: Ævar Arnfjörð Bjarmason @@ -36,7 +36,7 @@ EOF $im->add($mime); -$mime = PublicInbox::MIME->new(<<'EOF'); +$mime = PublicInbox::Eml->new(<<'EOF'); Subject: Message-ID: From: blank subject @@ -45,7 +45,7 @@ EOF $im->add($mime); -$mime = PublicInbox::MIME->new(<<'EOF'); +$mime = PublicInbox::Eml->new(<<'EOF'); Message-ID: From: no subject at all To: git@vger.kernel.org diff --git a/t/psgi_text.t b/t/psgi_text.t index b7b5b2d456e1580c6576efe8d35175f99a39bdee..833bcaba777c32638c1e816d15a58e755192e100 100644 --- a/t/psgi_text.t +++ b/t/psgi_text.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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"; diff --git a/t/psgi_v2.t b/t/psgi_v2.t index 9c19b0413dd1f0c20b61e58ea21c751006b88c9f..8f75a3fbf1958efa5d412f8cc6dee6c503136a8d 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -5,7 +5,7 @@ use warnings; 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 @@ -26,7 +26,7 @@ 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 @@ -225,7 +225,7 @@ is($res->code, 404, 'v2 git URL w/o shard fails'); # 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; diff --git a/t/purge.t b/t/purge.t index dcc440390e826f5e04cfd81565610353c9c2e668..2ca9edca73cbfda0f0d51e19b24f696728cef44e 100644 --- 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}); -my $mime = PublicInbox::MIME->new($raw); +my $mime = PublicInbox::Eml->new($raw); ok($v2w->add($mime), 'add message to be purged'); $v2w->done; diff --git a/t/replace.t b/t/replace.t index 2efa25f1457e685c7557477331694c88254cedb1..cef4e7aa6cbe6e57ebaed2c5998a436f62b43f38 100644 --- a/t/replace.t +++ b/t/replace.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use PublicInbox::InboxWritable; use PublicInbox::TestCommon; use Cwd qw(abs_path); @@ -24,7 +24,7 @@ -primary_address => 'test@example.com', indexlevel => $level, }); - my $orig = PublicInbox::MIME->new(<<'EOF'); + my $orig = PublicInbox::Eml->new(<<'EOF'); From: Barbra Streisand To: test@example.com Subject: confidential @@ -49,7 +49,7 @@ $im->done; 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 (['', ''], [], ['']) { $reject->header_set('Message-ID', @$mid); @@ -61,7 +61,7 @@ } # 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', ''); $repl->header_set('Subject', 'redacted'); $repl->header_set('Date', 'Sat, 02 Oct 2010 00:00:00 +0000'); @@ -80,7 +80,7 @@ } 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'); @@ -159,7 +159,7 @@ if (ref($i) eq 'HASH') { ($i, $irt) = each %$i; } my $sec = sprintf('%0d', $i); - my $mime = PublicInbox::MIME->new(<new(< diff --git a/t/reply.t b/t/reply.t index a6c38cfaaf2ba97cc4929994b930fbc2bab553cd..53162df5d2566be1097745890cac339d6e866124 100644 --- a/t/reply.t +++ b/t/reply.t @@ -3,7 +3,7 @@ # License: AGPL-3+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use_ok 'PublicInbox::Reply'; my @q = ( @@ -19,7 +19,7 @@ my $res = PublicInbox::Reply::squote_maybe($input); is($res, $expect, "quote $input => $res"); } -my $mime = PublicInbox::MIME->new(<<'EOF'); +my $mime = PublicInbox::Eml->new(<<'EOF'); From: from To: to Cc: cc@example.com diff --git a/t/search-thr-index.t b/t/search-thr-index.t index 1bea59fd87ae35c4988f4444fe1ff19cbaff3857..914807a843f4fb94ca370afb0180f8a255a25e1b 100644 --- a/t/search-thr-index.t +++ b/t/search-thr-index.t @@ -6,7 +6,7 @@ use bytes (); # only for bytes::length 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; @@ -42,7 +42,7 @@ my @mids; 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); @@ -78,7 +78,7 @@ $rw->commit_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 diff --git a/t/search.t b/t/search.t index 92f3305d556c5773fadc1e64f6e9f544904ff06f..6dd5047454aa48336895d72d843e22da8ec3ae38 100644 --- a/t/search.t +++ b/t/search.t @@ -8,7 +8,7 @@ require_mods(qw(DBD::SQLite Search::Xapian)); 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 }); @@ -60,7 +60,7 @@ } } $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: @@ -70,7 +70,7 @@ List-Id: I'm not mad \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: @@ -128,7 +128,7 @@ # ghost vivication $ibx->with_umask(sub { $rw_commit->(); my $rmid = ''; - 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: @@ -142,7 +142,7 @@ my $rv; 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 @@ -191,7 +191,7 @@ $ibx->with_umask(sub { $rw_commit->(); $ro->reopen; my $long_mid = 'last' . ('x' x 60). '@s'; - my $long = PublicInbox::MIME->new(<new(< @@ -211,7 +211,7 @@ my $res; my @res; my $long_reply_mid = 'reply-to-long@1'; - my $long_reply = PublicInbox::MIME->new(<new(< @@ -235,7 +235,7 @@ # 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: @@ -245,7 +245,7 @@ > 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: @@ -269,7 +269,7 @@ # circular references $ibx->with_umask(sub { my $s = 'foo://'. ('Circle' x 15).'/foo'; - my $doc_id = $rw->add_message(PublicInbox::MIME->new(<add_message(PublicInbox::Eml->new(< @@ -288,7 +288,7 @@ is($smsg->subject, $s, 'long subject not rewritten') if defined($smsg); }); $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]; @@ -371,7 +371,7 @@ } } $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; @@ -429,7 +429,7 @@ my $ua = 'Pine.LNX.4.10'; 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(<new(< From: torvalds\@transmeta diff --git a/t/solver_git.t b/t/solver_git.t index c483aba176a1fdd7b398cbe0eeb173a4d41129cd..78cc0edde0d29e9ac75bc4958f52bc090acae4ff 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -15,7 +15,7 @@ # 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 = { @@ -29,7 +29,7 @@ my $im = PublicInbox::V2Writable->new($ibx, 1); $im->{parallel} = 0; my $deliver_patch = sub ($) { - $im->add(mime_load($_[0])); + $im->add(eml_load($_[0])); $im->done; }; diff --git a/t/spamcheck_spamc.t b/t/spamcheck_spamc.t index edfacc62ddef895f0e240dc6347b707f7985ad08..2d9da63101e7f5b0153672599279f031d73e23b6 100644 --- a/t/spamcheck_spamc.t +++ b/t/spamcheck_spamc.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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; @@ -28,19 +28,19 @@ Subject: test Message-ID: 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']; -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'; - 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"); } diff --git a/t/thread-cycle.t b/t/thread-cycle.t index d6545c6df9955104ef930cc1f0ea5fd7dc29b79b..484ea443c9b1fabc30d2c2bbfb164aa026e2c0e3 100644 --- a/t/thread-cycle.t +++ b/t/thread-cycle.t @@ -3,8 +3,9 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; +use PublicInbox::TestCommon; +require_mods 'Email::Simple'; use_ok('PublicInbox::SearchThread'); -use Email::Simple; my $mt = eval { require Mail::Thread; no warnings 'once'; diff --git a/t/time.t b/t/time.t index 71600b93b60114e78e1a9debc4f47913881f9c74..b491711def65343eea8f0db73780909ddb527aa3 100644 --- a/t/time.t +++ b/t/time.t @@ -4,9 +4,9 @@ use strict; use warnings; use Test::More; use POSIX qw(strftime); -use PublicInbox::MIME; +use PublicInbox::Eml; 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 diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t index 23f4fb1181becc7f0a018cba8a5845da585ebc7a..2cd45f608e93b9c4a73a5d91e822db7a402cd4ce 100644 --- a/t/v1-add-remove-add.t +++ b/t/v1-add-remove-add.t @@ -5,7 +5,7 @@ use warnings; 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(); @@ -15,7 +15,7 @@ name => 'test-add-remove-add', -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 diff --git a/t/v1reindex.t b/t/v1reindex.t index e473fe7c3942a95f2db6dbca31b10a0d6d733243..13605f8bd6ce5de1915fe7bc58b1a03756377486 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -6,7 +6,7 @@ use Test::More; 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'; @@ -18,7 +18,7 @@ name => 'test-v1reindex', -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 diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t index 60a869eeb9d2462eeafdb21a431b96d27f5541ba..cfdc8cf1ddbfc980fc0d3ebb8318c09281c9d33d 100644 --- a/t/v2-add-remove-add.t +++ b/t/v2-add-remove-add.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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)); @@ -16,7 +16,7 @@ version => 2, -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 diff --git a/t/v2mda.t b/t/v2mda.t index 4d3ec30db91e4b99ac076826841d53e3e81a2ba0..36f43ff096c09c58e8df91e1e3053f2ac8b924e0 100644 --- 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 PublicInbox::MIME; +use PublicInbox::Eml; require_git(2.6); my $V = 2; @@ -18,7 +18,7 @@ inboxdir => "$tmpdir/inbox", 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 diff --git a/t/v2mirror.t b/t/v2mirror.t index ecf968912f6eb768a4edfa5630661bbdf23e44a2..d588808d645bc3a22410729d2ac273ae70292b49 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -15,7 +15,7 @@ use IO::Socket; 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(); @@ -38,7 +38,7 @@ $ibx->{version} = 2; 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 To: You Subject: a diff --git a/t/v2reindex.t b/t/v2reindex.t index b97c6498c27b085c029b792392e10c5181b422a3..f16a0b0d81c341c3da60ffe65c9529eddb5bfd6a 100644 --- a/t/v2reindex.t +++ b/t/v2reindex.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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; @@ -24,7 +24,7 @@ local $/; <$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 @@ -434,7 +434,7 @@ my %config = %$ibx_config; $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 @@ -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 - my $m1 = PublicInbox::MIME->new(<<'EOF'); + my $m1 = PublicInbox::Eml->new(<<'EOF'); From: a@example.com To: t@example.com Subject: [PATCH 12/13] diff --git a/t/v2writable.t b/t/v2writable.t index 07687052c0b7fe4f99b9ab1e6fc1442de2e41e81..e5a565cea23fa0a2ecd93b8eea017359a31d2299 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ 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); @@ -20,7 +20,7 @@ version => 2, -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 @@ -63,7 +63,7 @@ @warn = (); $mime->header_set('Message-Id', '', ''); 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', '', ''); ok($im->add($sec), 'secondary MID used if data is different'); @@ -90,7 +90,7 @@ $mime->body_set('this one needs a random mid'); 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'); diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t index 09217d94fcfa368e1215ec0a53ad252d5f0cc440..2e7d402e5fafb45143c99cc522e95ec458807e86 100644 --- a/t/watch_filter_rubylang.t +++ b/t/watch_filter_rubylang.t @@ -4,7 +4,7 @@ use strict; 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'; diff --git a/t/watch_maildir.t b/t/watch_maildir.t index c34d15f799a6123d2e2429a0ca46d9c0027fbf53..66955072cd58dc412eeeb5936493207429b2c870 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -2,7 +2,7 @@ # Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ use strict; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use Cwd; use PublicInbox::Config; use PublicInbox::TestCommon; diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t index dd5030ea0e89bfc4c0311f03e42212c43bfa8763..19a2da7707085b6d536472bd8fbf8525cfbd51d8 100644 --- a/t/watch_maildir_v2.t +++ b/t/watch_maildir_v2.t @@ -2,7 +2,7 @@ # Copyright (C) 2018-2020 all contributors # License: AGPL-3.0+ use strict; use Test::More; -use PublicInbox::MIME; +use PublicInbox::Eml; use Cwd; use PublicInbox::Config; use PublicInbox::TestCommon; diff --git a/t/www_altid.t b/t/www_altid.t index a885c3897c6bbbd7735acc1e9206777d8dba6aea..337303d9fc45bc22164850c34afe175737abd7dc 100644 --- a/t/www_altid.t +++ b/t/www_altid.t @@ -26,7 +26,7 @@ }; 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: diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index 0e1fea52d152a9415f502e97b7aeeae20579d28d..70012cc6f49ee9193816d660051076149235a415 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -6,11 +6,11 @@ use Test::More; 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; -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 diff --git a/xt/msgtime_cmp.t b/xt/msgtime_cmp.t index 4ebf5b2cedb85a859b771873452de3d92f95fb2b..95d7c64bec67a337eaccf44d5b4227d1925a2fad 100644 --- a/xt/msgtime_cmp.t +++ b/xt/msgtime_cmp.t @@ -4,7 +4,7 @@ # License: AGPL-3.0+ 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); @@ -48,7 +48,7 @@ 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); @@ -116,7 +116,7 @@ wantarray ? @$ret : $ret->[0]; } 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) { @@ -131,7 +131,7 @@ undef; } 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) { @@ -149,7 +149,7 @@ } # 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); @@ -158,7 +158,7 @@ } # 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); diff --git a/xt/perf-msgview.t b/xt/perf-msgview.t index a4445959406ae948ee0e124c003871c2b59cd23c..30fc07dcbc87ad812de8da9d41bb3df0bc1883e3 100644 --- a/xt/perf-msgview.t +++ b/xt/perf-msgview.t @@ -38,7 +38,7 @@ my $obuf = ''; 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 = '';