From 8360e96a8661d3cc0532f377db81a3f37babd126 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Jan 2009 14:11:15 -0500 Subject: blogspam: Log spam info on failure. --- IkiWiki/Plugin/blogspam.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index cc6e840f0..8462a6d1d 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -83,7 +83,7 @@ sub checkcontent (@) { # and "buy". push @options, "exclude=stopwords"; - my $res = $client->send_request('testComment', { + my %req={ ip => $ENV{REMOTE_ADDR}, comment => $params{content}, subject => defined $params{subject} ? $params{subject} : "", @@ -92,17 +92,20 @@ sub checkcontent (@) { options => join(",", @options), site => $config{url}, version => "ikiwiki ".$IkiWiki::version, - }); + }; + my $res = $client->send_request('testComment', %req); if (! ref $res || ! defined $res->value) { debug("failed to get response from blogspam server ($url)"); return undef; } elsif ($res->value =~ /^SPAM:(.*)/) { + eval q{use Data::Dumper}; + debug("blogspam server reports ".$res->value.": ".Dumper(\%req)); return gettext("Sorry, but that looks like spam to blogspam: ").$1; } elsif ($res->value ne 'OK') { - debug(gettext("blogspam server failure: ").$res->value); + debug("blogspam server failure: ".$res->value); return undef; } else { -- cgit v1.2.3