E-MailRelay
Classes | Public Types | Public Member Functions | List of all members
GSmtp::Filter Class Referenceabstract

An interface for processing a message file through a filter. More...

#include <gfilter.h>

+ Inheritance diagram for GSmtp::Filter:

Classes

struct  Exit
 Interprets an executable filter's exit code. More...
 

Public Types

enum class  Result { f_ok = 0 , f_abandon = 1 , f_fail = 2 }
 

Public Member Functions

virtual ~Filter ()=default
 Destructor.
 
virtual std::string id () const =0
 Returns the id passed to the derived-class constructor. More...
 
virtual bool simple () const =0
 Returns true if the concrete filter class is one that can never change the file (eg. More...
 
virtual void start (const MessageId &)=0
 Starts the filter for the given message. More...
 
virtual G::Slot::Signal< int > & doneSignal ()=0
 Returns a signal which is raised once start() has completed or failed. More...
 
virtual void cancel ()=0
 Aborts any incomplete filtering.
 
virtual bool abandoned () const =0
 Returns true if the filter result was 'abandoned'.
 
virtual std::string response () const =0
 Returns a non-empty response string iff the filter failed, or an empty response if successful or abandoned.
 
virtual std::string reason () const =0
 Returns a non-empty reason string iff the filter failed, or an empty reason if successful or abandoned.
 
virtual bool special () const =0
 Returns true if the filter indicated special handling is required.
 
std::string str (bool server_side) const
 Returns a diagnostic string for logging. More...
 

Detailed Description

An interface for processing a message file through a filter.

The interface is asynchronous, using a slot/signal completion callback.

Filters return a tri-state value (ok, abandon, fail) and a 'special' flag which is interpreted as 're-scan' for server filters and 'stop-scanning' for client filters.

The abandon state is treated more like success on the server side but more like failure on the client side.

The fail state has an associated public response (eg. "rejected") and a more expansive private reason.

Definition at line 48 of file gfilter.h.

Member Enumeration Documentation

◆ Result

enum class GSmtp::Filter::Result
strong

Definition at line 93 of file gfilter.h.

Member Function Documentation

◆ doneSignal()

virtual G::Slot::Signal< int > & GSmtp::Filter::doneSignal ( )
pure virtual

Returns a signal which is raised once start() has completed or failed.

The signal parameter is ok=0, abandon=1, fail=2.

◆ id()

virtual std::string GSmtp::Filter::id ( ) const
pure virtual

Returns the id passed to the derived-class constructor.

Used in logging.

◆ simple()

virtual bool GSmtp::Filter::simple ( ) const
pure virtual

Returns true if the concrete filter class is one that can never change the file (eg.

a do-nothing filter class).

◆ start()

virtual void GSmtp::Filter::start ( const MessageId )
pure virtual

Starts the filter for the given message.

Any previous, incomplete filtering is cancel()ed. Asynchronous completion is indicated by a doneSignal().

◆ str()

std::string GSmtp::Filter::str ( bool  server_side) const

Returns a diagnostic string for logging.

Definition at line 25 of file gfilter.cpp.


The documentation for this class was generated from the following files: