blogspam: Don't check modifications from admins for spam, and also allow the blogspam...
authorJoey Hess <joey@kitenet.net>
Mon, 24 Jan 2011 20:59:15 +0000 (16:59 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 24 Jan 2011 20:59:15 +0000 (16:59 -0400)
IkiWiki/Plugin/blogspam.pm
debian/changelog
doc/plugins/blogspam.mdwn

index f0b6cb2a2742519a2796bce8a863500f34d0d5f0..d32c2f169d643a7db9e9fffc292201a4bf93276e 100644 (file)
@@ -61,12 +61,18 @@ sub checkcontent (@) {
        my %params=@_;
        my $session=$params{session};
        
-       if (exists $config{blogspam_pagespec}) {
-               return undef
-                       if ! pagespec_match($params{page}, $config{blogspam_pagespec},
-                               location => $params{page});
+       my $spec='!admin()';
+       if (exists $config{blogspam_pagespec} &&
+           length $config{blogspam_pagespec}) {
+               $spec.=" and (".$config{blogspam_pagespec}.")";
        }
 
+       my $user=$session->param("name");
+       return undef unless pagespec_match($params{page}, $spec,
+               (defined $user ? (user => $user) : ()),
+               (defined $session->remote_addr() ? (ip => $session->remote_addr()) : ()),
+               location => $params{page});
+
        my $url=$defaulturl;
        $url = $config{blogspam_server} if exists $config{blogspam_server};
 
index 94eb507e6afb59e0b2b2bb4d2f089588ef41e055..ae2ff779e93408754a13824eaedbfa8826fc6f35 100644 (file)
@@ -1,6 +1,8 @@
 ikiwiki (3.20110124) UNRELEASED; urgency=low
 
   * comments: Fix commenting, broken by security fix.
+  * blogspam: Don't check modifications from admins for spam, and also
+    allow the blogspam_pagespec to do other matches against who the user is.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 24 Jan 2011 16:56:05 -0400
 
index a13b6e8f424c2fe511a5bd37cee7d51c3de0a33d..c158316d43bfab793f1039874974371c60ddcfc3 100644 (file)
@@ -23,7 +23,7 @@ you can check whether the interaction with blogspam.net works.
 The `blogspam_pagespec` setting is a [[ikiwiki/PageSpec]] that can be
 used to configure which pages are checked for spam. The default is to check
 all edits. If you only want to check [[comments]] (not wiki page edits),
-set it to "postcomment(*)".
+set it to "postcomment(*)". Posts by admins are never checked for spam.
 
 By default, the blogspam.net server is used to do the spam checking. To
 change this, the `blogspam_server` option can be set to the url for a