E-MailRelay
|
A concrete class implementing the GStore::NewMessage interface using files. More...
#include <gnewfile.h>
Public Member Functions | |
NewFile (FileStore &store, const std::string &from, const MessageStore::SmtpInfo &, const std::string &from_auth_out, std::size_t max_size) | |
Constructor. More... | |
~NewFile () override | |
Destructor. More... | |
G::Path | contentPath () const |
Returns the path of the content file. | |
NewFile (const NewFile &)=delete | |
NewFile (NewFile &&)=delete | |
NewFile & | operator= (const NewFile &)=delete |
NewFile & | operator= (NewFile &&)=delete |
![]() | |
virtual void | addTo (const std::string &to, bool local, MessageStore::AddressStyle)=0 |
Adds a 'to' address. | |
virtual Status | addContent (const char *, std::size_t)=0 |
Adds a line of content, typically ending with CR-LF. More... | |
virtual void | prepare (const std::string &session_auth_id, const std::string &peer_socket_address, const std::string &peer_certificate)=0 |
Prepares to store the message in the message store. More... | |
virtual void | commit (bool throw_on_error)=0 |
Commits the prepare()d message to the store and disables the cleanup otherwise performed by the destructor. More... | |
virtual MessageId | id () const =0 |
Returns the message's unique identifier. | |
virtual std::string | location () const =0 |
Returns the message's unique location. | |
virtual std::size_t | contentSize () const =0 |
Returns the content size. More... | |
void | addContentLine (const std::string &) |
A convenience function that calls addContent() taking a string parameter and adding CR-LF. More... | |
virtual | ~NewMessage ()=default |
Destructor. More... | |
Additional Inherited Members | |
![]() | |
enum class | Status { Ok , TooBig , Error } |
A concrete class implementing the GStore::NewMessage interface using files.
The prepare() override creates one ".envelope.new" file and one ".content" file.
The commit() override renames the envelope file to remove the ".new" filename extension. This makes it visible to FileStore::iterator().
Definition at line 48 of file gnewfile.h.
GStore::NewFile::NewFile | ( | FileStore & | store, |
const std::string & | from, | ||
const MessageStore::SmtpInfo & | smtp_info, | ||
const std::string & | from_auth_out, | ||
std::size_t | max_size | ||
) |
Constructor.
The max-size is the size limit, as also reported by the EHLO response, and is not the size estimate from MAIL-FROM.
Definition at line 37 of file gnewfile.cpp.
|
override |
Destructor.
If the new message has not been commit()ed then the files are deleted.
Definition at line 57 of file gnewfile.cpp.