On Tue, May 15, 2007 at 10:20:44PM +0100, Kake L Pugh wrote:
Hello. Following a discussion on #openguides,
I've added hooks for
spam detection.
The way it works is that you specify the name of a local module in
your wiki.conf, and OpenGuides will check all edits against this
module before agreeing to commit them. The module should provide a
method called "looks_like_spam", which will be passed the content and
metadata of the edit, and should return true (it's spam) or false
(it's not).
An example:
----------------------------------------------------------------------
package OpenGuides::Local::KakeSpamDetector;
use strict;
sub looks_like_spam {
my ( $class, %args ) = @_;
if ( $args{content} =~ /kitten/i ) {
return 1;
}
}
----------------------------------------------------------------------
Obviously you'll want a more serious check in there :) The neat thing
about doing it like this is that your spam detector module can do
_anything_ you like, including, for example, logging.
Comments?
Awesome. Obviously most user will be wanting to use one or more standard
spam plugin modules we provide, but this is an excellent start.
Dominic.
--
Dominic Hargreaves |
http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)