27 std::string part1 =
response().empty() ?
"ok=1" :
"ok=0" ;
28 std::string part2(
abandoned() ?
"abandon" :
"" ) ;
29 std::string part3(
special() ? (server_side?
"rescan":
"break") :
"" ) ;
31 std::ostringstream ss ;
34 <<
"response=[" <<
response() <<
"]" ;
36 ss <<
" reason=[" <<
reason() <<
"]" ;
41GSmtp::Filter::Exit::Exit(
int exit_code ,
bool server_side ) :
42 result(Result::f_fail) ,
47 result = Result::f_ok ;
49 else if( exit_code >= 1 && exit_code < 100 )
51 result = Result::f_fail ;
53 else if( exit_code == 100 )
55 result = Result::f_abandon ;
57 else if( exit_code == 101 )
59 result = Result::f_ok ;
63 const bool rescan = true ;
64 if( exit_code == 102 )
66 result = Result::f_abandon ;
special = rescan ;
68 else if( exit_code == 103 )
70 result = Result::f_ok ;
special = rescan ;
72 else if( exit_code == 104 )
74 result = Result::f_fail ;
special = rescan ;
79 const bool stop_scanning = true ;
80 if( exit_code == 102 )
82 result = Result::f_ok ;
special = stop_scanning ;
84 else if( exit_code == 103 )
86 result = Result::f_ok ;
88 else if( exit_code == 104 )
90 result = Result::f_abandon ;
special = stop_scanning ;
92 else if( exit_code == 105 )
94 result = Result::f_fail ;
special = stop_scanning ;
99bool GSmtp::Filter::Exit::ok()
const
101 return result == Result::f_ok ;
104bool GSmtp::Filter::Exit::abandon()
const
106 return result == Result::f_abandon ;
109bool GSmtp::Filter::Exit::fail()
const
111 return result == Result::f_fail ;
virtual bool special() const =0
Returns true if the filter indicated special handling is required.
virtual std::string response() const =0
Returns a non-empty response string iff the filter failed, or an empty response if successful or aban...
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(bool server_side) const
Returns a diagnostic string for logging.
virtual bool abandoned() const =0
Returns true if the filter result was 'abandoned'.
static std::string join(const std::string &sep, const StringArray &strings)
Concatenates an array of strings with separators.