_comment directive: if the user looks like an OpenID, store that

master
Simon McVittie 2008-12-18 19:56:36 +00:00
parent 4176c3483d
commit f4e69ed815
1 changed files with 20 additions and 2 deletions

View File

@ -151,11 +151,28 @@ sub preprocess {
my $commentip; my $commentip;
my $commentauthor; my $commentauthor;
my $commentauthorurl; my $commentauthorurl;
my $commentopenid;
if (defined $params{username}) { if (defined $params{username}) {
$commentuser = $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 { else {
if (defined $params{ip}) { if (defined $params{ip}) {
@ -165,6 +182,7 @@ sub preprocess {
} }
$pagestate{$page}{comments}{commentuser} = $commentuser; $pagestate{$page}{comments}{commentuser} = $commentuser;
$pagestate{$page}{comments}{commentopenid} = $commentopenid;
$pagestate{$page}{comments}{commentip} = $commentip; $pagestate{$page}{comments}{commentip} = $commentip;
$pagestate{$page}{comments}{commentauthor} = $commentauthor; $pagestate{$page}{comments}{commentauthor} = $commentauthor;
$pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl; $pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl;