- my $list_id = $addr;
- $list_id =~ s/@/./;
- $mime->header_set('List-Id', "<$list_id>");
- my $str = $mime->as_string;
- $str =~ s/(?<!\r)\n/\r\n/sg;
- $len = length($str);
- undef $str;
- $im->add($mime);
- $im->done;
- if ($version == 1) {
- ok(run_script(['-index', $ibx->{inboxdir}]),
- 'indexed v1');
- }
- }
+my $list_id = $addr;
+$list_id =~ s/@/./;
+$eml->header_set('List-Id', "<$list_id>");
+my $str = $eml->as_string;
+$str =~ s/(?<!\r)\n/\r\n/sg;
+my $len = length($str);
+undef $str;
+
+my $ibx = create_inbox "v$version", version => $version, indexlevel => 'basic',
+ tmpdir => $inboxdir, sub {
+ my ($im, $ibx) = @_;
+ $im->add($eml) or BAIL_OUT;
+};
+undef $eml;
+my $other = create_inbox "other$version", version => $version,
+ indexlevel => 'basic', sub {
+ my ($im) = @_;
+ $im->add(eml_load 't/utf8.eml') or BAIL_OUT;
+};
+
+local $ENV{HOME} = $home;
+mkdir $home or BAIL_OUT $!;
+mkdir "$home/.public-inbox" or BAIL_OUT $!;
+open my $cfgfh, '>', "$home/.public-inbox/config" or BAIL_OUT $!;
+print $cfgfh <<EOF or BAIL_OUT;
+[publicinbox "$group"]
+ inboxdir = $inboxdir
+ url = http://example.com/abc
+ address = $addr
+ indexlevel = basic
+ newsgroup = $group
+[publicinbox "xyz"]
+ inboxdir = $other->{inboxdir}
+ url = http://example.com/xyz
+ address = e\@example.com
+ indexlevel = basic
+ newsgroup = x.y.z
+[publicinboxMda]
+ spamcheck = none
+EOF
+close $cfgfh or BAIL_OUT;