SK.gnome.dwarf.mail.smtp.proc.agent
Class AntiSpam

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.GenericServer
          extended bySK.gnome.dwarf.thread.ThreadServer
              extended bySK.gnome.dwarf.mail.smtp.proc.MailAgent
                  extended bySK.gnome.dwarf.mail.smtp.proc.agent.MessageCheck
                      extended bySK.gnome.dwarf.mail.smtp.proc.agent.MessageSyntax
                          extended bySK.gnome.dwarf.mail.smtp.proc.agent.AntiSpam
All Implemented Interfaces:
Preprocessing, SK.gnome.dwarf.Reportable, java.lang.Runnable, SK.gnome.dwarf.Server, SK.gnome.dwarf.Service

public class AntiSpam
extends MessageSyntax

Provides anti-spam agent.

This is only a basis for more sophisticated antispam agent. It can check if the remote client address or the domain of the message sender is on a blacklist. It may check also the message subject and body if it contains a banned keyword.


Field Summary
 
Fields inherited from class SK.gnome.dwarf.mail.smtp.proc.MailAgent
context, required
 
Fields inherited from class SK.gnome.dwarf.thread.ThreadServer
daemon, thread
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
AntiSpam(java.lang.String name)
           
 
Method Summary
protected  void checkMimePart(MailAgentMessage message, java.util.Collection recipients, MimePart part)
          Checks the MIME body part.
protected  void preprocess(MailAgentMessage message, java.util.Collection recipients)
          Processes the message.
 void setBannedClients(SK.gnome.dwarf.tcpip.InetHostSet hosts)
           
 void setBannedDomains(java.lang.String[] domains)
           
 void setBannedExtensions(java.lang.String[] extensions)
           
 void setBannedKeywords(java.lang.String[] keywords)
           
 void setCheckBodyText(boolean enable)
           
 
Methods inherited from class SK.gnome.dwarf.mail.smtp.proc.agent.MessageSyntax
setCheckAddresses, setCheckBody, setCheckHeaders, setMaxMessageHops
 
Methods inherited from class SK.gnome.dwarf.mail.smtp.proc.agent.MessageCheck
fail, fail, init, setFailedState, setStoreTo
 
Methods inherited from class SK.gnome.dwarf.mail.smtp.proc.MailAgent
destroy, filter, init, isRequired, postprocess, setRequired, storeMessage
 
Methods inherited from class SK.gnome.dwarf.thread.ThreadServer
enableThread, finish, loop, run, setDaemon, shutdown, start, stop
 
Methods inherited from class SK.gnome.dwarf.GenericServer
addService, addService, getAuthenticator, getLogger, getParameters, getService, getServices, getServices, removeService, report
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getName, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface SK.gnome.dwarf.Service
getFullName, getName, getState, log, log, login, logout
 

Constructor Detail

AntiSpam

public AntiSpam(java.lang.String name)
Method Detail

setBannedClients

public void setBannedClients(SK.gnome.dwarf.tcpip.InetHostSet hosts)

setBannedDomains

public void setBannedDomains(java.lang.String[] domains)

setBannedKeywords

public void setBannedKeywords(java.lang.String[] keywords)

setBannedExtensions

public void setBannedExtensions(java.lang.String[] extensions)

setCheckBodyText

public void setCheckBodyText(boolean enable)

preprocess

protected void preprocess(MailAgentMessage message,
                          java.util.Collection recipients)
                   throws java.io.IOException,
                          MailException
Description copied from class: MailAgent
Processes the message.

This method is called on the agent only once for each message, just after it has arrived to the mail queue. In order to let this happen, the agent must implement the Preprocessing interface.

The recipients argument is a collection of Recipient objects representing the message recipients, as returned after processing by the mail filter chain. This collection is always non-empty.

Overrides:
preprocess in class MessageSyntax
Throws:
java.io.IOException
MailException

checkMimePart

protected void checkMimePart(MailAgentMessage message,
                             java.util.Collection recipients,
                             MimePart part)
                      throws java.io.IOException,
                             MailException
Description copied from class: MessageSyntax
Checks the MIME body part.

This method checks a single MIME body part. It may be overriden to include an additional checking operation.

By default it iterates over the nested MIME body parts of the given part and calls checkMimePart for each one.

Overrides:
checkMimePart in class MessageSyntax
Parameters:
message - the checked message
recipients - the recipient collection
part - the checked MIME body part
Throws:
MailException - if another error occured
java.io.IOException - if an I/O error occured


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.