]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
handle repeated References and In-Reply-To headers
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index 1142ca7a0f4c83a6aa4103edc79d91bd04944e5a..8a529c66c2d60257437c55219f0ad028acff22dc 100644 (file)
@@ -291,17 +291,12 @@ sub link_message {
        my $mid = $smsg->mid;
        my $mime = $smsg->{mime};
        my $hdr = $mime->header_obj;
-       my $refs = $hdr->header_raw('References');
-       my @refs = defined $refs ? ($refs =~ /<([^>]+)>/g) : ();
-       my $irt = $hdr->header_raw('In-Reply-To');
-       if (defined $irt) {
-               if ($irt eq '') {
-                       $irt = undef;
-               } else {
-                       $irt = mid_clean($irt);
-                       $irt = undef if $mid eq $irt;
-               }
-       }
+
+       # last References should be IRT, but some mail clients do things
+       # out of order, so trust IRT over References iff IRT exists
+       my @refs = ($hdr->header_raw('References'),
+                       $hdr->header_raw('In-Reply-To'));
+       @refs = ((join(' ', @refs)) =~ /<([^>]+)>/g);
 
        my $tid;
        if (@refs) {
@@ -309,15 +304,6 @@ sub link_message {
                my @orig_refs = @refs;
                @refs = ();
 
-               if (defined $irt) {
-                       # to check MAX_MID_SIZE
-                       push @orig_refs, $irt;
-
-                       # below, we will ensure IRT (if specified)
-                       # is the last References
-                       $uniq{$irt} = 1;
-               }
-
                # prevent circular references via References: here:
                foreach my $ref (@orig_refs) {
                        if (length($ref) > MAX_MID_SIZE) {
@@ -329,10 +315,6 @@ sub link_message {
                }
        }
 
-       # last References should be IRT, but some mail clients do things
-       # out of order, so trust IRT over References iff IRT exists
-       push @refs, $irt if defined $irt;
-
        if (@refs) {
                $smsg->{references} = '<'.join('> <', @refs).'>';