@@ -378,15 +378,18 @@ BEGIN
378
378
# shortlog or commit will display an avatar associated with
379
379
# the email of the committer(s) and/or author(s).
380
380
381
- # Currently only the gravatar provider is available, and it
382
- # depends on Digest::MD5. If an unknown provider is specified,
383
- # the feature is disabled.
381
+ # Currently available providers are gravatar and picon.
382
+ # If an unknown provider is specified, the feature is disabled.
383
+
384
+ # Gravatar depends on Digest::MD5.
385
+ # Picon currently relies on the indiana.edu database.
384
386
385
387
# To enable system wide have in $GITWEB_CONFIG
386
- # $feature{'avatar'}{'default'} = ['gravatar'];
388
+ # $feature{'avatar'}{'default'} = ['<provider>'];
389
+ # where <provider> is either gravatar or picon.
387
390
# To have project specific config enable override in $GITWEB_CONFIG
388
391
# $feature{'avatar'}{'override'} = 1;
389
- # and in project config gitweb.avatar = gravatar ;
392
+ # and in project config gitweb.avatar = <provider> ;
390
393
' avatar' => {
391
394
' sub' => \&feature_avatar,
392
395
' override' => 0,
@@ -853,6 +856,8 @@ sub evaluate_path_info {
853
856
our ($git_avatar ) = gitweb_get_feature(' avatar' );
854
857
if ($git_avatar eq ' gravatar' ) {
855
858
$git_avatar = ' ' unless (eval { require Digest::MD5; 1; });
859
+ } elsif ($git_avatar eq ' picon' ) {
860
+ # no dependencies
856
861
} else {
857
862
$git_avatar = ' ' ;
858
863
}
@@ -1520,6 +1525,20 @@ sub format_subject_html {
1520
1525
# given page, there's no risk for cache conflicts.
1521
1526
our %avatar_cache = ();
1522
1527
1528
+ # Compute the picon url for a given email, by using the picon search service over at
1529
+ # http://www.cs.indiana.edu/picons/search.html
1530
+ sub picon_url {
1531
+ my $email = lc shift ;
1532
+ if (!$avatar_cache {$email }) {
1533
+ my ($user , $domain ) = split (' @' , $email );
1534
+ $avatar_cache {$email } =
1535
+ " http://www.cs.indiana.edu/cgi-pub/kinzler/piconsearch.cgi/" .
1536
+ " $domain /$user /" .
1537
+ " users+domains+unknown/up/single" ;
1538
+ }
1539
+ return $avatar_cache {$email };
1540
+ }
1541
+
1523
1542
# Compute the gravatar url for a given email, if it's not in the cache already.
1524
1543
# Gravatar stores only the part of the URL before the size, since that's the
1525
1544
# one computationally more expensive. This also allows reuse of the cache for
@@ -1544,9 +1563,10 @@ sub git_get_avatar {
1544
1563
my $url = " " ;
1545
1564
if ($git_avatar eq ' gravatar' ) {
1546
1565
$url = gravatar_url($email , $size );
1566
+ } elsif ($git_avatar eq ' picon' ) {
1567
+ $url = picon_url($email );
1547
1568
}
1548
- # Currently only gravatars are supported, but other forms such as
1549
- # picons can be added by putting an else up here and defining $url
1569
+ # Other providers can be added by extending the if chain, defining $url
1550
1570
# as needed. If no variant puts something in $url, we assume avatars
1551
1571
# are completely disabled/unavailable.
1552
1572
if ($url ) {
0 commit comments