+# used by V2Writable, too
+sub prepend_mid ($$) {
+ my ($hdr, $mid0) = @_;
+ # @cur is likely empty if we need to call this sub, but it could
+ # have random unparseable crap which we'll preserve, too.
+ my @cur = $hdr->header_raw('Message-Id');
+ $hdr->header_set('Message-Id', "<$mid0>", @cur);
+}
+
+sub v1_mid0 ($) {
+ my ($mime) = @_;
+ my $hdr = $mime->header_obj;
+ my $mids = mids($hdr);
+
+ if (!scalar(@$mids)) { # spam often has no Message-Id
+ my $mid0 = digest2mid(content_digest($mime));
+ prepend_mid($hdr, $mid0);
+ return $mid0;
+ }
+ $mids->[0];
+}
+