21 #ifndef G_SMTP_SPAM_CLIENT_H
22 #define G_SMTP_SPAM_CLIENT_H
49 G_EXCEPTION( Error ,
"spam client error" ) ;
52 unsigned int connect_timeout ,
unsigned int response_timeout ) ;
55 void request(
const std::string & file_path ) ;
71 static void username(
const std::string & ) ;
81 virtual bool onReceive(
const char * ,
size_t ,
size_t )
override ;
87 virtual void onSecure(
const std::string & )
override ;
90 virtual void onDelete(
const std::string & )
override ;
102 explicit Request(
Client & ) ;
103 void send(
const std::string & path ,
const std::string & username ) ;
106 std::ifstream m_stream ;
108 std::vector<char> m_buffer ;
112 explicit Response(
bool read_only ) ;
114 void add(
const std::string & ,
const std::string & ) ;
115 bool ok(
const std::string & )
const ;
116 bool complete()
const ;
117 std::string result()
const ;
120 std::string m_path_tmp ;
121 std::string m_path_final ;
122 std::ofstream m_stream ;
123 size_t m_content_length ;
125 std::string m_result ;
133 Response m_response ;
134 static std::string m_username ;
bool busy() const
Returns true after request() and before the subsequent event signal.
SMTP and message-store classes.
SpamClient(const GNet::Location &host_and_service, bool read_only, unsigned int connect_timeout, unsigned int response_timeout)
Constructor.
bool send(const std::string &data, std::string::size_type offset=0)
Sends data to the peer.
virtual bool onReceive(const char *, size_t, size_t) override
Override from GNet::Client.
static void username(const std::string &)
Sets the username used in the network protocol.
virtual void onSecure(const std::string &) override
Override from GNet::SocketProtocolSink.
virtual void onDelete(const std::string &) override
Override from GNet::HeapClient.
A class that holds a host/service name pair and the preferred address family (if any), and also the results of a name-to-address lookup, ie.
virtual ~SpamClient()
Destructor.
A client class that interacts with a remote process using a protocol somewhat similar to the spamassa...
A class which acts as an SMTP client, extracting messages from a message store and forwarding them to...
virtual void onSendComplete() override
Override from GNet::SimpleClient.
virtual void onConnect() override
Override from GNet::SimpleClient.
A timer class template in which the timeout is delivered to the specified method. ...
A HeapClient class that adds slot/signal signalling, connection/response timeouts, and input line buffering.
void request(const std::string &file_path)
Starts sending a request that comprises a few http-like header lines followed by the contents of the ...