From ea796b6cf43908baacaf6b3ba58fa4efa861d0c4 Mon Sep 17 00:00:00 2001 From: cjwatson <> Date: Wed, 11 May 2005 08:52:23 -0800 Subject: [PATCH] [project @ 2005-05-11 09:52:23 by cjwatson] Properly support multiple submitter addresses on a single bug. --- cgi/bugreport.cgi | 4 ++-- cgi/common.pl | 33 +++++++++++++++++++++------------ cgi/pkgindex.cgi | 13 ++++++++----- debian/changelog | 1 + 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 166d2d8..28035e2 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -181,8 +181,8 @@ if ($status{severity} eq 'normal') { $indexentry .= "

$showseverity"; $indexentry .= htmlpackagelinks($status{package}, 0); -$indexentry .= "Reported by: " . htmlsanit($status{originator}) . ";\n"; +$indexentry .= htmladdresslinks("Reported by: ", \&submitterurl, + $status{originator}) . ";\n"; $indexentry .= "Owned by: " . htmlsanit($status{owner}) . ";\n" if length $status{owner}; diff --git a/cgi/common.pl b/cgi/common.pl index 2c0bf94..db9d1f4 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -244,25 +244,34 @@ sub htmlpackagelinks { ) . ";\n"; } -# Generate a comma-separated list of HTML links to each maintainer given in -# $maints, which should be a comma-separated list of RFC822 addresses. -sub htmlmaintlinks { - my ($prefixfunc, $maints) = @_; - if (defined $maints and $maints ne '') { - my @maintaddrs = getparsedaddrs($maints); - my $prefix = (ref $prefixfunc) ? $prefixfunc->(scalar @maintaddrs) +# Generate a comma-separated list of HTML links to each address given in +# $addresses, which should be a comma-separated list of RFC822 addresses. +# $urlfunc should be a reference to a function like mainturl or submitterurl +# which returns the URL for each individual address. +sub htmladdresslinks { + my ($prefixfunc, $urlfunc, $addresses) = @_; + if (defined $addresses and $addresses ne '') { + my @addrs = getparsedaddrs($addresses); + my $prefix = (ref $prefixfunc) ? $prefixfunc->(scalar @addrs) : $prefixfunc; return $prefix . join ', ', map { sprintf '%s', - mainturl($_->address), + $urlfunc->($_->address), htmlsanit($_->format) || '(unknown)' - } @maintaddrs; + } @addrs; } else { my $prefix = (ref $prefixfunc) ? $prefixfunc->(1) : $prefixfunc; - return sprintf '%s(unknown)', $prefix, mainturl(''); + return sprintf '%s(unknown)', $prefix, $urlfunc->(''); } } +# Generate a comma-separated list of HTML links to each maintainer given in +# $maints, which should be a comma-separated list of RFC822 addresses. +sub htmlmaintlinks { + my ($prefixfunc, $maints) = @_; + return htmladdresslinks($prefixfunc, \&mainturl, $maints); +} + sub htmlindexentry { my $ref = shift; my %status = %{getbugstatus($ref)}; @@ -286,8 +295,8 @@ sub htmlindexentrystatus { $result .= htmlpackagelinks($status{"package"}, 1); $result .= $showseverity; - $result .= "Reported by: " . htmlsanit($status{originator}) . ""; + $result .= htmladdresslinks("Reported by: ", \&submitterurl, + $status{originator}); $result .= ";\nOwned by: " . htmlsanit($status{owner}) if length $status{owner}; $result .= ";\nTags: " diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi index 029ecd8..5854671 100755 --- a/cgi/pkgindex.cgi +++ b/cgi/pkgindex.cgi @@ -110,11 +110,14 @@ if ($indexon eq "pkg") { } elsif ($indexon eq "submitter") { $tag = "submitter"; my %fullname = (); - %count = countbugs(sub {my %d=@_; my $f = $d{"submitter"} || ""; - my $em = emailfromrfc822($f); - $fullname{$em} = $f if (!defined $fullname{$em}); - return $em; - }); + %count = countbugs(sub {my %d=@_; + my @se = getparsedaddrs($d{"submitter"} || ""); + foreach my $addr (@se) { + $fullname{$addr->address} = $addr->format + unless exists $fullname{$addr->address}; + } + map { $_->address } @se; + }); foreach my $sub (keys %count) { $sortkey{$sub} = lc $fullname{$sub}; $htmldescrip{$sub} = sprintf('%s', diff --git a/debian/changelog b/debian/changelog index e1b25e4..02ddaed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low (closes: #222077). - Decode RFC1522 mail headers for display in the web interface. bugreport.cgi and pkgreport.cgi now output UTF-8. + - Properly support multiple submitter addresses on a single bug. * Adam Heath: - Rewrite filtering in cgi's common.pl, to make it completely generic. -- 2.39.2