* 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:
(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
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
# `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
perl
Devel::Peek
Digest::SHA
- Email::Simple
- Email::MIME
- Email::MIME::ContentType
Encode
ExtUtils::MakeMaker
IO::Compress::Gzip
}
# 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);
# 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};
#
# 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:
#
}
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) {
}
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) {
# 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);
# 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);
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);
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> }));
}
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';
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!
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));
};
$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!
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));
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
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
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
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
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)) {
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);
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
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;
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");
}
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");
}
$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");
$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");
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');
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');
}
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");
}
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Feed;
use PublicInbox::Import;
use PublicInbox::Inbox;
{
$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>
# 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>
{
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');
}
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');
}
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 };
$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=?=
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use_ok 'PublicInbox::Filter::Vger';
my $f = PublicInbox::Filter::Vger->new;
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');
}
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');
}
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Feed;
use PublicInbox::Git;
use PublicInbox::Import;
$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
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));
# 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
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Git;
use PublicInbox::Import;
use PublicInbox::Spawn qw(spawn);
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
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Inbox;
use PublicInbox::InboxWritable;
require PublicInbox::Admin;
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
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);
"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;
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Config;
use PublicInbox::TestCommon;
require_git(2.6);
# 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)');
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>');
+#!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;
-use warnings;
use Test::More;
-use_ok 'PublicInbox::MIME';
+use PublicInbox::TestCommon;
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
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
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,
--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();
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 $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 $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 $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]};
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::MsgTime;
use PublicInbox::TestCommon;
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
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
# 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);
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
EOF
-my $good = PublicInbox::MIME->new(<<EOF);
+my $good = PublicInbox::Eml->new(<<EOF);
Message-ID: <b\@example.com>
From: b\@example.com
To: $addr
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';
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' } };
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
{
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) {
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;
# 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
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
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!
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
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);
:(
EOF
$crlf =~ s/\n/\r\n/sg;
- $im->add(PublicInbox::MIME->new($crlf));
+ $im->add(PublicInbox::Eml->new($crlf));
$im->done;
}
use strict;
use warnings;
use Test::More;
-use Email::Simple;
+use PublicInbox::Eml;
use PublicInbox::MDA;
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
}
{
- do_checks(Email::Simple->new(<<'EOF'));
+ do_checks(PublicInbox::Eml->new(<<'EOF'));
From: a@example.com
To: b@example.com
Cc: c@example.com
}
{
- 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>
{
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
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);
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
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++
}
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";
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
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
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
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);
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
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::Config;
use PublicInbox::Inbox;
use PublicInbox::InboxWritable;
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>
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>
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
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 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
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
# 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;
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;
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use PublicInbox::InboxWritable;
use PublicInbox::TestCommon;
use Cwd qw(abs_path);
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
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);
# 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');
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');
($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>
use strict;
use warnings;
use Test::More;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
use_ok 'PublicInbox::Reply';
my @q = (
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
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;
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);
$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
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 });
}
$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>
\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>
$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>
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
$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>
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>
# 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>
> 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>
# 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>
});
$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];
}
$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;
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
# 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 = {
$im->{parallel} = 0;
my $deliver_patch = sub ($) {
- $im->add(mime_load($_[0]));
+ $im->add(eml_load($_[0]));
$im->done;
};
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;
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'];
-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");
}
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';
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
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();
-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
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';
-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
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));
-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
use Fcntl qw(SEEK_SET);
use Cwd;
use PublicInbox::TestCommon;
-use PublicInbox::MIME;
+use PublicInbox::Eml;
require_git(2.6);
my $V = 2;
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
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();
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
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;
<$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
$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
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]
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);
-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
@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');
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');
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';
# 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;
# 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;
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>
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
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);
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);
}
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) {
}
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) {
# 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);
# 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 $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 = '';