E-MailRelay
|
An interface for processing a message file through a filter. More...
#include <gfilter.h>
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... | |
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.
|
pure virtual |
Returns a signal which is raised once start() has completed or failed.
The signal parameter is ok=0, abandon=1, fail=2.
|
pure virtual |
Returns the id passed to the derived-class constructor.
Used in logging.
|
pure virtual |
Returns true if the concrete filter class is one that can never change the file (eg.
a do-nothing filter class).
|
pure virtual |
Starts the filter for the given message.
Any previous, incomplete filtering is cancel()ed. Asynchronous completion is indicated by a doneSignal().
std::string GSmtp::Filter::str | ( | bool | server_side | ) | const |
Returns a diagnostic string for logging.
Definition at line 25 of file gfilter.cpp.