New Message: Re: Comment Spam Problems

webmaster at userland.com webmaster at userland.com
Tue Nov 30 19:14:15 PST 2004


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$652

By: Lawrence Lee (lawrence at userland.com)

You can use the commentSubmit callback to block a comment before it's posted.

config.manila.callbacks.commentSubmit

Here's a snippet of code (see below) you can use in your callback to block comments with more than x number of links.

Blocker.root uses the MT Blacklist, but it's still alpha and currently doesn't use the comment callback but uses one that can block any DG new/modified message:

http://frontier.userland.com/discuss/msgReader$13500

I let Jan know about the new callback, so the comment callback might be a feature for a future version.

I'll also pass along your feature requests re: blocking comments to old posts.

Lawrence

===

bundle { //block based on number of links in the comment
 local (maxNumLinks = 5);
 local (numLinks);
 on countRefs (s) {

 local (listone, linkPattern = "<a[ \t\r\n]*[^]*href[ \t\r\n]*=[ \t\r\n]*\"?([-_~%@:/\\.A-Za-z0-9]+)");

 regex.extract (linkPattern, @s, @listone, {1});
 return (sizeOf (listone))};
 numLinks = countRefs (commentText);
 if numLinks = maxNumLinks {
 return (false)}} //block it, don't track

This is a Manila site.. http://manila.userland.com/.




More information about the Frontier-Users mailing list