com.limegroup.gnutella.filters
Class SpamFilter

java.lang.Object
  extended bycom.limegroup.gnutella.filters.SpamFilter
Direct Known Subclasses:
AllowFilter, CompositeFilter, DuplicateFilter, GreedyQueryFilter, GUIDFilter, IPFilter, KeywordFilter, RequeryFilter, SpamReplyFilter

public abstract class SpamFilter
extends java.lang.Object

A filter to eliminate Gnutella spam. Subclass to implement custom filters. Each Gnutella connection has two SpamFilters; the personal filter (for filtering results and the search monitor) and a route filter (for deciding what I even consider). (Strategy pattern.) Note that a packet stopped by the route filter will never reach the personal filter.

Because one filter is used per connection, and only one invocation of the run(..) method is used, filters are not synchronized by default. The exception is BlackListFilter, which uses the Singleton pattern and thus must be synchronized.


Constructor Summary
SpamFilter()
           
 
Method Summary
abstract  boolean allow(Message m)
          Returns true iff this is considered spam and should not be processed.
static SpamFilter newPersonalFilter()
          Returns a new instance of a SpamFilter subclass based on the current settings manager.
static SpamFilter newRouteFilter()
          Returns a new instance of a SpamFilter subclass based on the current settings manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpamFilter

public SpamFilter()
Method Detail

newPersonalFilter

public static SpamFilter newPersonalFilter()
Returns a new instance of a SpamFilter subclass based on the current settings manager. (Factory method) This filter is intended for deciding which packets I display in search results.


newRouteFilter

public static SpamFilter newRouteFilter()
Returns a new instance of a SpamFilter subclass based on the current settings manager. (Factory method) This filter is intended for deciding which packets to route.


allow

public abstract boolean allow(Message m)
Returns true iff this is considered spam and should not be processed.