Quasi-Spam Filter Plugin
A reference implementation of a Spam filter plugin.
/!\ I strongly recommend you to use SpamLookup plugin bundled with Movable Type 3.2. I won't maintenance this any more.
Changes
- 0.10(2005.01.28):
- First Release.
- 0.15(2005.02.01):
- Support TBPing spam filtering.
- 0.17(2005.03.05):
- Support Perl 5.0.
- 0.20(2005.04.08):
- Support Logging feature and refine the interfaces of spam-detection functions.
Overview
This is a reference implementation of a Spam filter plugin and mainly targetted to spam filter developpers as well as actual users. This plugin allows you to easily customize your filtering policy and your reaction to comment & trackback spammers.
How to customize
Filtering Policy
The default policy of this plugin is to drop comments and trackback pings which have H1 and A elements. If you want to change your target, you can customize $COMMENT_PATTERN and $TBPING_PATTERN variable.
# Set your spam pattern our $COMMENT_PATTERN = '<h1>|<a\s'; # H1 or A elements our $TBPING_PATTERN = '<h1>|<a\s'; # H1 or A elements
You can change the is_comment_spam and is_tbping_spam subroutines if you want more clever mechanisms for filtering.
sub is_comment_spam {
my $comment = shift;
return ($comment->text =~ /$COMMENT_PATTERN/i);
}
sub is_tbping_spam {
my $tbping = shift;
return ($tbping->excerpt =~ /$TBPING_PATTERN/i);
}
Reaction to Commment Spammers
The default reaction to comment spammers is "NOT TO TELL SPAMMERS WHETHER COMMENT SUBMISSIONS ARE SUCCEEDED OR NOT, BUT KILL THEM" reaction :) The Quasi-Spam Filter Plugin supports the following six reactions to comment spammers. And you can choose one of them by setting $COMMENT_METHOD variable.
CommentFilter
This method does not tell spammers whether comment submissions are succeeded or not.
CommentThrottleFilter
This method tells spammers that their comment submissions are failed by MT throttling mechanism.
CommentError (Default)
Just outputs a simple "Spam Comment!" message. This is the most light-weight solution.
CommentLongError
Outputs a kind error message by using "Comment Error Template".
CommentRedirect
Redirects to the URL specified by $URL variable. You can leed spammers to "Enlightment" site, or "Bizarre" site, or whatever else.
CommentEvilRedirect
Redirects to the URL specified by the URL field of spammers. If no URL is filled, redirects to the URL specified by $URL variable.
If you want to stop filtering spam comments, just set anything else (ex. ) to $COMMENT_METHOD variable.
Reaction to Trackback Spammers
The default reaction to trackback spammers is "NOT TO TELL SPAMMERS WHETHER TRACKBACK PINGS ARE SUCCEEDED OR NOT, BUT KILL THEM" reaction :) The Quasi-Spam Filter Plugin supports the following three reactions to trackback spammers. And you can choose one of them by setting $TBPING_METHOD variable.
TBPingFilter
This method does not tell spammers whether trackback pings are succeeded or not.
TBPingThrottleFilter
This method tells spammers that their trackback pings are failed by MT throttling mechanism.
TBPingError (Default)
Just outputs a simple "TBPing Comment!" message. This is the most light-weight solution.
If you want to stop filtering spam TB pings, just set anything else (ex. ) to $TBPPING_METHOD variable.
See Also
- Quasi-Spam_Filter_Plugin.ja_JP (Japanese document)
- /quasi-spamfilter (TracBrowser)
License
This code is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html.
Author & Copyright
Copyright 2004, Hirotaka Ogawa (hirotaka.ogawa at gmail.com)
