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" ) ;
48 NewFile(
FileStore & store ,
const std::string & from ,
const std::string & from_auth_in ,
49 const std::string & from_auth_out = std::string() ,
size_t max_size = 0UL ) ;
56 virtual void addTo(
const std::string & to ,
bool local )
override ;
59 virtual bool addText(
const char * ,
size_t )
override ;
62 virtual std::string
prepare(
const std::string & auth_id ,
const std::string & peer_socket_address ,
63 const std::string & peer_certificate )
override ;
72 virtual void commit(
bool strict )
override ;
78 virtual unsigned long id()
const override ;
88 std::string m_from_auth_in ;
89 std::string m_from_auth_out ;
92 unique_ptr<std::ostream> m_content ;
104 void flushContent() ;
105 void discardContent() ;
106 bool commitEnvelope() ;
107 void deleteContent() ;
108 void deleteEnvelope() ;
109 static bool isEightBit(
const char * ,
size_t ) ;
110 static const char * crlf() ;
111 static std::string xnormalise(
const std::string & ) ;
112 bool saveEnvelope(
const std::string & auth_id ,
const std::string & peer_socket_address ,
113 const std::string & peer_certificate )
const ;
114 void writeEnvelope( std::ostream & ,
const std::string & where ,
115 const std::string & auth_id ,
const std::string & peer_socket_address ,
116 const std::string & peer_certificate )
const ;
virtual void commit(bool strict) override
Override from GSmtp::NewMessage.
G::Path contentPath() const
Returns the path of the content file.
SMTP and message-store classes.
std::vector< std::string > StringArray
A std::vector of std::strings.
virtual ~NewFile()
Destructor.
NewFile(FileStore &store, const std::string &from, const std::string &from_auth_in, const std::string &from_auth_out=std::string(), size_t max_size=0UL)
Constructor. The FileStore reference is kept.
virtual unsigned long id() const override
Override from GSmtp::NewMessage.
virtual void addTo(const std::string &to, bool local) override
Override from GSmtp::NewMessage.
A concrete derived class implementing the NewMessage interface.
virtual bool addText(const char *, size_t) override
Override from GSmtp::NewMessage.
A concrete implementation of the MessageStore interface dealing in paired flat files.
virtual std::string prepare(const std::string &auth_id, const std::string &peer_socket_address, const std::string &peer_certificate) override
Override from GSmtp::NewMessage.
An abstract class to allow the creation of a new message in the message store.
A Path object represents a file system path.