28 bool server_side ,
const std::string & server ,
29 unsigned int connection_timeout ,
unsigned int response_timeout ) :
30 m_exception_handler(exception_handler) ,
31 m_server_side(server_side) ,
33 m_connection_timeout(connection_timeout) ,
34 m_response_timeout(response_timeout) ,
37 m_client.eventSignal().connect(
G::Slot::slot(*
this,&GSmtp::NetworkFilter::clientEvent) ) ;
42 m_client.eventSignal().disconnect() ;
47 return m_location.displayString() ;
57 if( !m_lazy || m_client.get() == nullptr )
59 m_client.reset(
new RequestClient(
"scanner",
"ok",m_location,m_connection_timeout,m_response_timeout) );
62 m_client->request( path ) ;
65 void GSmtp::NetworkFilter::clientEvent( std::string s1 , std::string s2 )
67 G_DEBUG(
"GSmtp::NetworkFilter::clientEvent: [" << s1 <<
"] [" << s2 <<
"]" ) ;
73 m_done_signal.emit( m_text.empty() ? 0 : 2 ) ;
75 catch( std::exception & e )
77 m_exception_handler.onException( e ) ;
100 return m_done_signal ;
static std::string printable(const std::string &in, char escape= '\\')
Returns a printable represention of the given input string.
static std::string tail(const std::string &in, size_type pos, const std::string &default_=std::string())
Returns the last part of the string after the given position.
virtual void start(const std::string &path) override
Override from from GSmtp::Filter.
static std::string head(const std::string &in, size_type pos, const std::string &default_=std::string())
Returns the first part of the string up to just before the given position.
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events...
virtual std::string response() const override
Override from from GSmtp::Filter.
virtual ~NetworkFilter()
Destructor.
virtual std::string reason() const override
Override from from GSmtp::Filter.
Slot0 slot(T &object, void(T::*fn)())
A slot factory function overloaded for a zero-parameter callback.
virtual bool simple() const override
Override from from GSmtp::Filter.
NetworkFilter(GNet::ExceptionHandler &, bool server_side, const std::string &server_location, unsigned int connection_timeout, unsigned int response_timeout)
Constructor.
virtual G::Slot::Signal1< int > & doneSignal() override
Override from from GSmtp::Filter.
virtual void cancel() override
Override from from GSmtp::Filter.
virtual bool special() const override
Override from from GSmtp::Filter.
A network client class that interacts with a remote server using a stateless line-based request/respo...
virtual bool abandoned() const override
Override from from GSmtp::Filter.
virtual std::string id() const override
Override from from GSmtp::Filter.