21#ifndef G_SMTP_NEW_FILE_H
22#define G_SMTP_NEW_FILE_H
45 G_EXCEPTION( InvalidPath ,
"invalid path: must be absolute" ) ;
46 G_EXCEPTION( FileError ,
"message store error" ) ;
47 G_EXCEPTION( TooBig ,
"message too big" ) ;
49 NewFile(
FileStore & store ,
const std::string & from ,
const std::string & from_auth_in ,
50 const std::string & from_auth_out , std::size_t max_size ,
bool test_for_eight_bit ) ;
63 void operator=(
const NewFile & ) = delete ;
64 void operator=(
NewFile && ) = delete ;
67 void commit(
bool strict )
override ;
68 std::string location()
const override ;
70 void addTo(
const std::string & to ,
bool local )
override ;
71 bool addText(
const char * , std::size_t )
override ;
72 bool prepare(
const std::string & auth_id ,
const std::string & peer_socket_address ,
73 const std::string & peer_certificate )
override ;
76 enum class State { New , Normal } ;
80 void discardContent() ;
81 bool commitEnvelope() ;
82 void deleteContent() ;
83 void deleteEnvelope() ;
84 static bool isEightBit(
const char * , std::size_t ) ;
92 std::unique_ptr<std::ofstream> m_content ;
94 bool m_test_for_eight_bit ;
97 std::size_t m_max_size ;
A structure containing the contents of an envelope file, with support for file reading,...
A concrete implementation of the MessageStore interface dealing in paired flat files.
A somewhat opaque identifer for a MessageStore message.
A concrete derived class implementing the GSmtp::NewMessage interface.
G::Path contentPath() const
Returns the path of the content file.
~NewFile() override
Destructor.
NewFile(FileStore &store, const std::string &from, const std::string &from_auth_in, const std::string &from_auth_out, std::size_t max_size, bool test_for_eight_bit)
Constructor. The FileStore reference is kept.
An abstract class to allow the creation of a new message in the message store.
A Path object represents a file system path.
SMTP and message-store classes.