From a3726968bc13f19f458c372cbd7cf92ae4c6fce5 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 19 Jan 2009 19:44:39 +0100 Subject: make checkcontent compatible with hooks that need the full content Always pass the full (modified) content in `content` named parameter. When the user edits an existing wiki page, also pass a `diff` named parameter, which includes only the lines that they added to the page, or modified. Signed-off-by: intrigeri --- IkiWiki/Plugin/blogspam.pm | 2 +- IkiWiki/Plugin/editpage.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index cc6e840f0..d4b5b36d5 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -85,7 +85,7 @@ sub checkcontent (@) { my $res = $client->send_request('testComment', { ip => $ENV{REMOTE_ADDR}, - comment => $params{content}, + comment => defined $params{diff} ? $params{diff} : $params{content}, subject => defined $params{subject} ? $params{subject} : "", name => defined $params{author} ? $params{author} : "", link => exists $params{url} ? $params{url} : "", diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 658d664af..4540b55d0 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -93,7 +93,7 @@ sub check_content (@) { foreach my $line (split("\n", $params{content})) { push @diff, $line if ! exists $old{$_}; } - $params{content}=join("\n", @diff); + $params{diff}=join("\n", @diff); } my $ok; -- cgit v1.2.3