use warnings;
use strict;
use IkiWiki;
+use URI::Escape q{uri_escape_utf8};
sub import {
hook(type => "checkconfig", id => "tla", call => \&checkconfig);
}
}
-sub rcs_commit ($$$;$$$) {
- my $file=shift;
- my $message=shift;
- my $rcstoken=shift;
- my $user=shift;
- my $ipaddr=shift;
- my $emailuser=shift;
-
- if (defined $user) {
- $message="web commit by $user".(length $message ? ": $message" : "");
- }
- elsif (defined $ipaddr) {
- $message="web commit from $ipaddr".(length $message ? ": $message" : "");
+sub rcs_commit (@) {
+ my %params=@_;
+
+ my ($file, $message, $rcstoken)=
+ ($params{file}, $params{message}, $params{token});
+
+ if (defined $params{session}) {
+ if (defined $params{session}->param("name")) {
+ $message="web commit by ".
+ IkiWiki::cloak($params{session}->param("name")).
+ (length $message ? ": $message" : "");
+ }
+ elsif (defined $params{session}->remote_addr()) {
+ $message="web commit from ".
+ IkiWiki::cloak($params{session}->remote_addr()).
+ (length $message ? ": $message" : "");
+ }
}
if (-d "$config{srcdir}/{arch}") {
return undef # success
}
-sub rcs_commit_staged ($$$;$) {
+sub rcs_commit_staged (@) {
# Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename.
- my ($message, $user, $ipaddr, $emailuser)=@_;
+ my %params=@_;
error("rcs_commit_staged not implemented for tla"); # TODO
}
foreach my $file (@paths) {
my $diffurl=defined $config{diffurl} ? $config{diffurl} : "";
- $diffurl=~s/\[\[file\]\]/$file/g;
+ my $efile = uri_escape_utf8($file);
+ $diffurl=~s/\[\[file\]\]/$efile/g;
$diffurl=~s/\[\[rev\]\]/$change/g;
push @pages, {
page => pagename($file),