From: Don Armstrong Date: Thu, 14 Mar 2013 21:29:23 +0000 (-0700) Subject: Merge branch 'don/fix_encoding' X-Git-Tag: release/2.6.0~308^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=562a7c58b49da86ab3e63855952f9ebc3fdad4f1;hp=2974d0eb4bd99284b379c91dad39733429b195f4;p=debbugs.git Merge branch 'don/fix_encoding' --- diff --git a/Debbugs/CGI/Bugreport.pm b/Debbugs/CGI/Bugreport.pm index 707c3a0..29602c5 100644 --- a/Debbugs/CGI/Bugreport.pm +++ b/Debbugs/CGI/Bugreport.pm @@ -32,6 +32,8 @@ use base qw(Exporter); use IO::Scalar; use Params::Validate qw(validate_with :types); +use Digest::MD5 qw(md5_hex); +use Debbugs::Mail qw(get_addresses); use Debbugs::MIME qw(decode_rfc1522 create_mime_message); use Debbugs::CGI qw(:url :html :util); use Debbugs::Common qw(globify_scalar english_join); @@ -133,19 +135,25 @@ sub display_entity { not $param{terse} and not exists $param{att}) { my $header = $entity->head; - print {$param{output}} "
\n";
+	 print {$param{output}} "
\n"; if ($param{trim_headers}) { my @headers; foreach (qw(From To Cc Subject Date)) { my $head_field = $head->get($_); next unless defined $head_field and $head_field ne ''; - push @headers, qq($_: ) . html_escape(decode_rfc1522($head_field)); + if ($_ eq 'From') { + my $libravatar_url = __libravatar_url(decode_rfc1522($head_field)); + if (defined $libravatar_url and length $libravatar_url) { + push @headers,q(); + } + } + push @headers, qq(

$_: ) . html_escape(decode_rfc1522($head_field))."

"; } print {$param{output}} join(qq(), @headers); } else { - print {$param{output}} html_escape(decode_rfc1522($entity->head->stringify)); + print {$param{output}} "
".html_escape(decode_rfc1522($entity->head->stringify))."
\n"; } - print {$param{output}} "
\n"; + print {$param{output}} "\n"; } if (not (($param{outer} and $type =~ m{^text(?:/plain)?(?:;|$)}) @@ -426,6 +434,15 @@ sub handle_record{ } +sub __libravatar_url { + my ($email) = @_; + if (not defined $config{libravatar_uri} or not length $config{libravatar_uri}) { + return undef; + } + ($email) = get_addresses($email); + return $config{libravatar_uri}.md5_hex(lc($email)).($config{libravatar_uri_options}//''); +} + 1; diff --git a/Debbugs/Config.pm b/Debbugs/Config.pm index 87e61a2..3a6e7cf 100644 --- a/Debbugs/Config.pm +++ b/Debbugs/Config.pm @@ -364,6 +364,38 @@ Default: list_domain set_default(\%config,'bug_subscription_domain',$config{list_domain}); +=head2 CGI Options + +=over + +=item libravatar_uri + +URI to a libravatar configuration. If empty or undefined, libravatar +support will be disabled. Defaults to +http://cdn.libravatar.org/avatar/ which uses a federated Avatar system +and falls back to gravatar if necessary. + +=cut + +set_default(\%config,'libravatar_uri',"http://cdn.libravatar.org/avatar/"); + +=item libravatar_uri_options + +Options to append to the md5_hex of the e-mail. This sets the default +avatar used when an avatar isn't available. Currently defaults to +'?d=retro', which causes a bitmap-looking avatar to be displayed for +unknown e-mails. + +Other options which make sense include ?d=404, ?d=wavatar, etc. See +the API of libravatar for details. + +=cut + +set_default(\%config,'libravatar_uri_options','?d=retro'); + + +=back + =head2 Misc Options =over diff --git a/debian/changelog b/debian/changelog index 43e110f..14a0d66 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ debbugs (2.4.2~exp2) UNRELEASED; urgency=low (closes: #691573). Thanks to Jonathan Nieder. * Fix failure to forcibly merge/merge when found/fixed is not qualified (closes: #670456). Thanks to Jonathan Nieder and Bernhard Schmidt. + * Add libravatar support. [Thanks to Arnout Engelen: ] * Add Homepage (closes: #670555). diff --git a/html/bugs.css b/html/bugs.css index db1d34b..8e32445 100644 --- a/html/bugs.css +++ b/html/bugs.css @@ -126,6 +126,29 @@ pre.headers { line-height: 120% } +div.headers { + border: #a7a7a7 1px solid; + background-color: #f0f0f0; + padding: 2px; + } + +div.headers p { + font-family: sans-serif; + font-size: 95%; + color: #3c3c3c; + padding: 0px; + line-height: 120%; + margin: 0px; +} + +div.headers img { + float: right; +} + +span.header { + font-weight: bold + }; + pre.mime { font-family: monospace; font-size: 95%;