blogspam: Log spam info on failure.

master
Joey Hess 2009-01-19 14:11:15 -05:00
parent d79b8f809a
commit 8360e96a86
2 changed files with 7 additions and 3 deletions

View File

@ -83,7 +83,7 @@ sub checkcontent (@) {
# and "buy". # and "buy".
push @options, "exclude=stopwords"; push @options, "exclude=stopwords";
my $res = $client->send_request('testComment', { my %req={
ip => $ENV{REMOTE_ADDR}, ip => $ENV{REMOTE_ADDR},
comment => $params{content}, comment => $params{content},
subject => defined $params{subject} ? $params{subject} : "", subject => defined $params{subject} ? $params{subject} : "",
@ -92,17 +92,20 @@ sub checkcontent (@) {
options => join(",", @options), options => join(",", @options),
site => $config{url}, site => $config{url},
version => "ikiwiki ".$IkiWiki::version, version => "ikiwiki ".$IkiWiki::version,
}); };
my $res = $client->send_request('testComment', %req);
if (! ref $res || ! defined $res->value) { if (! ref $res || ! defined $res->value) {
debug("failed to get response from blogspam server ($url)"); debug("failed to get response from blogspam server ($url)");
return undef; return undef;
} }
elsif ($res->value =~ /^SPAM:(.*)/) { 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 <a href=\"http://blogspam.net/\">blogspam</a>: ").$1; return gettext("Sorry, but that looks like spam to <a href=\"http://blogspam.net/\">blogspam</a>: ").$1;
} }
elsif ($res->value ne 'OK') { elsif ($res->value ne 'OK') {
debug(gettext("blogspam server failure: ").$res->value); debug("blogspam server failure: ".$res->value);
return undef; return undef;
} }
else { else {

1
debian/changelog vendored
View File

@ -2,6 +2,7 @@ ikiwiki (3.03) UNRELEASED; urgency=low
* Avoid feeding decoded unicode to Term::ReadLine. * Avoid feeding decoded unicode to Term::ReadLine.
Closes: 512169 Closes: 512169
* blogspam: Log spam info on failure.
-- Joey Hess <joeyh@debian.org> Sun, 18 Jan 2009 14:50:57 -0500 -- Joey Hess <joeyh@debian.org> Sun, 18 Jan 2009 14:50:57 -0500