summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-18 19:56:36 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-20 17:34:54 +0000
commitf4e69ed815ca65f38ee9d19219f33dabeb92b97e (patch)
tree15930284679f7afd18b742ac57cd320c6017783f
parent4176c3483ddd3a12d57676c5ed6dfcc49796fbc0 (diff)
_comment directive: if the user looks like an OpenID, store that
-rw-r--r--IkiWiki/Plugin/comments.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index c50729a34..336ed1a82 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -151,11 +151,28 @@ sub preprocess {
my $commentip;
my $commentauthor;
my $commentauthorurl;
+ my $commentopenid;
if (defined $params{username}) {
$commentuser = $params{username};
- ($commentauthorurl, $commentauthor) =
- linkuser($params{username});
+
+ my $oiduser = eval { IkiWiki::openiduser($commentuser) };
+
+ if (defined $oiduser) {
+ # looks like an OpenID
+ $commentauthorurl = $commentuser;
+ $commentauthor = $oiduser;
+ $commentopenid = $commentuser;
+ }
+ else {
+ $commentauthorurl = IkiWiki::cgiurl(
+ do => 'commenter',
+ page => (length $config{userdir}
+ ? "$config{userdir}/$commentuser"
+ : "$commentuser"));
+
+ $commentauthor = $commentuser;
+ }
}
else {
if (defined $params{ip}) {
@@ -165,6 +182,7 @@ sub preprocess {
}
$pagestate{$page}{comments}{commentuser} = $commentuser;
+ $pagestate{$page}{comments}{commentopenid} = $commentopenid;
$pagestate{$page}{comments}{commentip} = $commentip;
$pagestate{$page}{comments}{commentauthor} = $commentauthor;
$pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl;