28 std::ostringstream ss ;
31 if( r == Result::fail )
33 else if( r == Result::abandon )
34 ss <<
"ok(abandon) " ;
39 ss << ( type == Filter::Type::server ?
"+rescan " :
"+break " ) ;
41 ss <<
"response=[" <<
response() <<
"]" ;
44 ss <<
" reason=[" <<
reason() <<
"]" ;
51 return type == Type::server ?
"filter"_sv :
52 ( type == Type::client ?
"client-filter"_sv :
"routing-filter"_sv ) ;
55GSmtp::Filter::Exit::Exit(
int exit_code , Filter::Type type ) :
56 result(Result::fail) ,
63 else if( exit_code >= 1 && exit_code < 100 )
67 else if( exit_code == 100 )
71 else if( exit_code == 101 )
76 bool server_side = type == Filter::Type::server ;
79 const bool rescan = true ;
80 if( exit_code == 102 )
84 else if( exit_code == 103 )
88 else if( exit_code == 104 )
95 const bool stop_scanning = true ;
96 if( exit_code == 102 )
100 else if( exit_code == 103 )
104 else if( exit_code == 104 )
108 else if( exit_code == 105 )
115bool GSmtp::Filter::Exit::ok()
const
117 return result == Result::ok ;
120bool GSmtp::Filter::Exit::abandon()
const
122 return result == Result::abandon ;
126bool GSmtp::Filter::Exit::fail()
const
128 return result == Result::fail ;
virtual Result result() const =0
Returns the filter result, after the doneSignal() has been emitted.
virtual bool special() const =0
Returns true if the filter indicated special handling is required.
static G::string_view strtype(Type type) noexcept
Returns a type string for logging: "filter", "client-filter" or "routing-filter".
virtual std::string response() const =0
Returns a non-empty SMTP response string iff the filter failed, or an empty response if successful or...
virtual std::string reason() const =0
Returns a non-empty reason string iff the filter failed, or an empty reason if successful or abandone...
std::string str(Type type) const
Returns a diagnostic string for logging, including the filter result.
A class like c++17's std::string_view.