diff options
author | Eric Wong <e@80x24.org> | 2015-08-15 09:28:32 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-15 19:15:36 +0000 |
commit | d7fcdec712accc212bcfa35e50ade1233eb9beb3 (patch) | |
tree | 50e4900b3a21ede89b76716417080113009f1b75 /lib/PublicInbox/Hval.pm | |
parent | 885250c3c289c96764e0eb9f432a389136d07088 (diff) | |
download | public-inbox-d7fcdec712accc212bcfa35e50ade1233eb9beb3.tar.gz |
Quit repeating ourselves and use a common MID module instead.
Diffstat (limited to 'lib/PublicInbox/Hval.pm')
-rw-r--r-- | lib/PublicInbox/Hval.pm | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index 68f89546..d8b31c84 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -8,6 +8,7 @@ use warnings; use fields qw(raw href); use Encode qw(find_encoding); use URI::Escape qw(uri_escape_utf8); +use PublicInbox::MID qw/mid_clean mid_compressed/; my $enc_ascii = find_encoding('us-ascii'); @@ -25,16 +26,8 @@ sub new { sub new_msgid { my ($class, $msgid) = @_; - $msgid =~ s/\A\s*<?//; - $msgid =~ s/>?\s*\z//; - - if (length($msgid) <= 40) { - $class->new($msgid); - } else { - require Digest::SHA; - my $hex = Digest::SHA::sha1_hex($msgid); - $class->new($msgid, $hex); - } + $msgid = mid_clean($msgid); + $class->new($msgid, mid_compressed($msgid)); } sub new_oneline { |