comments: add OpenID-based avatars (libravatar.org)
authorFrancois Marier <francois@debian.org>
Sun, 27 Mar 2011 03:22:49 +0000 (16:22 +1300)
committerFrancois Marier <francois@debian.org>
Wed, 30 Mar 2011 07:59:18 +0000 (20:59 +1300)
This requires version 1.04 or later of Libravatar::URL.

IkiWiki/Plugin/comments.pm

index 2f2a515b9be5c2c061e8f9c65d827e8119660f37..bccb977e3b3e06e21175575d587727c327778e55 100755 (executable)
@@ -192,9 +192,10 @@ sub preprocess {
                 eval 'use Libravatar::URL';
 
                 if (! $@) {
-                    my $email = IkiWiki::userinfo_get($commentuser, 'email');
-
-                    if (defined $email) {
+                    if (defined $commentopenid) {
+                        $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
+                    }
+                    elsif (my $email = IkiWiki::userinfo_get($commentuser, 'email')) {
                         $commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
                     }
                 }