21#ifndef G_SMTP_SPAM_CLIENT_H
22#define G_SMTP_SPAM_CLIENT_H
49 G_EXCEPTION( Error ,
"spam client error" ) ;
52 bool read_only ,
unsigned int connect_timeout ,
unsigned int response_timeout ) ;
55 void request(
const std::string & file_path ) ;
71 static void username(
const std::string & ) ;
75 void onConnect()
override ;
76 bool onReceive(
const char * , std::size_t , std::size_t , std::size_t ,
char )
override ;
77 void onSendComplete()
override ;
78 void onSecure(
const std::string & ,
const std::string & ,
const std::string & )
override ;
79 void onDelete(
const std::string & )
override ;
85 void operator=(
const SpamClient & ) = delete ;
91 static GNet::Client::Config netConfig(
unsigned int connect_timeout ,
unsigned int response_timeout ) ;
96 explicit Request(
Client & ) ;
97 void send(
const std::string & path ,
const std::string &
username ) ;
100 std::ifstream m_stream ;
102 std::vector<char> m_buffer ;
106 explicit Response(
bool read_only ) ;
108 Response(
const Response & ) = delete ;
109 Response( Response && ) = delete ;
110 void operator=(
const Response & ) = delete ;
111 void operator=( Response && ) = delete ;
112 void add(
const std::string & ,
const std::string & ) ;
113 bool ok(
const std::string & )
const ;
114 bool complete()
const ;
115 std::string result()
const ;
118 std::string m_path_tmp ;
119 std::string m_path_final ;
120 std::ofstream m_stream ;
121 std::size_t m_content_length ;
123 std::string m_result ;
131 Response m_response ;
132 static std::string m_username ;
A class for making an outgoing connection to a remote server, with support for socket-level protocols...
bool send(const std::string &data, std::size_t offset=0)
Sends data to the peer and starts the response timer (if configured).
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A class that represents the remote target for out-going client connections.
A timer class template in which the timeout is delivered to the specified method.
A class which acts as an SMTP client, extracting messages from a message store and forwarding them to...
A client class that interacts with a remote process using a protocol somewhat similar to the spamassa...
static void username(const std::string &)
Sets the username used in the network protocol.
SpamClient(GNet::ExceptionSink, const GNet::Location &host_and_service, bool read_only, unsigned int connect_timeout, unsigned int response_timeout)
Constructor.
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 ...
bool busy() const
Returns true after request() and before the subsequent event signal.
SMTP and message-store classes.
A structure containing GNet::Client configuration parameters.