[OGDev] Support for spam detection

Kake L Pugh kake at earth.li
Tue May 15 22:20:44 BST 2007


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?

Kake



More information about the OpenGuides-Dev mailing list