27 const std::string & server ,
unsigned int connection_timeout ,
unsigned int response_timeout ) :
29 m_file_store(file_store) ,
31 m_connection_timeout(connection_timeout) ,
32 m_response_timeout(response_timeout)
34 m_client_ptr.eventSignal().connect(
G::Slot::slot(*
this,&GSmtp::NetworkFilter::clientEvent) ) ;
35 m_client_ptr.deletedSignal().connect(
G::Slot::slot(*
this,&GSmtp::NetworkFilter::clientDeleted) ) ;
40 m_client_ptr.eventSignal().disconnect() ;
41 m_client_ptr.deletedSignal().disconnect() ;
44std::string GSmtp::NetworkFilter::id()
const
46 return m_location.displayString() ;
49bool GSmtp::NetworkFilter::simple()
const
54void GSmtp::NetworkFilter::start(
const MessageId & message_id )
57 if( m_client_ptr.get() ==
nullptr )
59 m_client_ptr.reset( std::make_unique<RequestClient>(
62 m_location , m_connection_timeout , m_response_timeout ) ) ;
64 m_client_ptr->request( m_file_store.contentPath(message_id).str() ) ;
67void GSmtp::NetworkFilter::clientDeleted(
const std::string & reason )
71 m_text =
"failed" "\t" + reason ;
72 m_done_signal.emit( 2 ) ;
76void GSmtp::NetworkFilter::clientEvent(
const std::string & s1 ,
const std::string & s2 ,
const std::string & )
81 m_done_signal.emit( m_text.empty() ? 0 : 2 ) ;
85bool GSmtp::NetworkFilter::special()
const
90std::string GSmtp::NetworkFilter::response()
const
96std::string GSmtp::NetworkFilter::reason()
const
103 return m_done_signal ;
106void GSmtp::NetworkFilter::cancel()
108 m_client_ptr.reset() ;
112bool GSmtp::NetworkFilter::abandoned()
const
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A concrete implementation of the MessageStore interface dealing in paired flat files.
~NetworkFilter() override
Destructor.
NetworkFilter(GNet::ExceptionSink, FileStore &, const std::string &server_location, unsigned int connection_timeout, unsigned int response_timeout)
Constructor.
static std::string tail(const std::string &in, std::size_t pos, const std::string &default_=std::string())
Returns the last part of the string after the given position.
static std::string printable(const std::string &in, char escape='\\')
Returns a printable representation of the given input string, using chacter code ranges 0x20 to 0x7e ...
static std::string head(const std::string &in, std::size_t pos, const std::string &default_=std::string())
Returns the first part of the string up to just before the given position.
Slot< Args... > slot(TSink &sink, void(TSink::*method)(Args...))
A factory function for Slot objects.