E-MailRelay
|
An interface used by the ServerProtocol class to assemble and process an incoming message. More...
#include <gprotocolmessage.h>
Classes | |
struct | FromInfo |
Extra information from the SMTP MAIL-FROM command passed to GSmtp::ProtocolMessage::setFrom(). More... | |
struct | ProcessedInfo |
Parameters for GSmtp::ProtocolMessage::processedSignal() More... | |
struct | ToInfo |
Extra information passed to GSmtp::ProtocolMessage::addTo(). More... | |
Public Types | |
using | ProcessedSignal = G::Slot::Signal< const ProcessedInfo & > |
using | AddressStyle = GStore::MessageStore::AddressStyle |
Public Member Functions | |
virtual | ~ProtocolMessage ()=default |
Destructor. | |
virtual ProcessedSignal & | processedSignal ()=0 |
Returns a signal which is raised once process() has completed. | |
virtual void | reset ()=0 |
Clears the message state, terminates any asynchronous message processing and resets the object as if just constructed. More... | |
virtual void | clear ()=0 |
Clears the message state and terminates any asynchronous message processing. | |
virtual GStore::MessageId | setFrom (const std::string &from_user, const FromInfo &)=0 |
Sets the message envelope 'from' address etc. More... | |
virtual bool | addTo (const ToInfo &to)=0 |
Adds an envelope 'to'. More... | |
virtual void | addReceived (const std::string &)=0 |
Adds a 'received' line to the start of the content. More... | |
virtual GStore::NewMessage::Status | addContent (const char *, std::size_t)=0 |
Adds content. More... | |
void | addContentLine (const std::string &) |
A convenience function that calls addContent() taking a string parameter and adding CR-LF. More... | |
virtual std::size_t | contentSize () const =0 |
Returns the current content size. More... | |
virtual std::string | from () const =0 |
Returns the setFrom() user string. | |
virtual FromInfo | fromInfo () const =0 |
Returns the setFrom() extra info. | |
virtual std::string | bodyType () const =0 |
Returns the setFrom() body type, fromInfo().body. | |
virtual void | process (const std::string &session_auth_id, const std::string &peer_socket_address, const std::string &peer_certificate)=0 |
Starts asynchronous processing of the message. More... | |
An interface used by the ServerProtocol class to assemble and process an incoming message.
It implements the three 'buffers' mentioned in RFC-2821 (esp. section 4.1.1).
This interface serves to decouple the protocol class from the downstream message processing – hence the name. Derived classes implement different types of downstream processing. For store-and-forward behaviour the ProtocolMessageStore class uses GSmtp::MessageStore to store messages; for proxying behaviour the ProtocolMessageForward class uses GSmtp::Client to do immediate forwarding.
The interface is used by the protocol class in the following sequence:
The process() method is asynchronous, but note that the completion signal may be emitted before the initiating call returns.
Definition at line 64 of file gprotocolmessage.h.
using GSmtp::ProtocolMessage::AddressStyle = GStore::MessageStore::AddressStyle |
Definition at line 76 of file gprotocolmessage.h.
using GSmtp::ProtocolMessage::ProcessedSignal = G::Slot::Signal<const ProcessedInfo&> |
Definition at line 75 of file gprotocolmessage.h.
|
pure virtual |
void GSmtp::ProtocolMessage::addContentLine | ( | const std::string & | line | ) |
A convenience function that calls addContent() taking a string parameter and adding CR-LF.
Definition at line 26 of file gprotocolmessage.cpp.
|
pure virtual |
Adds a 'received' line to the start of the content.
Precondition: at least one successful addTo() call
|
pure virtual |
Adds an envelope 'to'.
See also GSmtp::Verifier::verify(). Returns false if an invalid user.
|
pure virtual |
Returns the current content size.
Returns the maximum std::size_t value on overflow.
|
pure virtual |
Starts asynchronous processing of the message.
Once processing is complete the message state is cleared and the processedSignal() is raised. All errors are also signalled via the processedSignal(). The processedSignal() may be emitted before process() returns.
The session-auth-id parameter is used to propagate authentication information from the SMTP AUTH command into individual messages. It is the empty string for unauthenticated clients. See also GAuth::SaslServer::id().
|
pure virtual |
Clears the message state, terminates any asynchronous message processing and resets the object as if just constructed.
(In practice this is clear() plus the disconnection of any forwarding client).
|
pure virtual |
Sets the message envelope 'from' address etc.
Returns a unique message id.