mids references/;
use URI::Escape qw(uri_escape_utf8);
use Digest::SHA qw/sha1_hex/;
-use constant MID_MAX => 40; # SHA-1 hex length
+use constant {
+ MID_MAX => 40, # SHA-1 hex length # TODO: get rid of this
+ MAX_MID_SIZE => 244, # max term size (Xapian limitation) - length('Q')
+};
sub mid_clean {
my ($mid) = @_;
push(@mids, $v);
}
}
+ foreach my $i (0..$#mids) {
+ next if length($mids[$i]) <= MAX_MID_SIZE;
+ warn "Message-ID: <$mids[$i]> too long, truncating\n";
+ $mids[$i] = substr($mids[$i], 0, MAX_MID_SIZE);
+ }
+
uniq_mids(\@mids);
}