21 #ifndef G_SMTP_STORED_FILE_H
22 #define G_SMTP_STORED_FILE_H
48 G_EXCEPTION( InvalidFormat ,
"invalid format field in envelope" ) ;
49 G_EXCEPTION( NoEnd ,
"invalid envelope file: misplaced end marker" ) ;
50 G_EXCEPTION( InvalidTo ,
"invalid 'to' line in envelope file" ) ;
51 G_EXCEPTION( NoRecipients ,
"no remote recipients" ) ;
52 G_EXCEPTION( OpenError ,
"cannot open the envelope" ) ;
53 G_EXCEPTION( StreamError ,
"envelope reading/parsing error" ) ;
54 G_EXCEPTION( InvalidFilename ,
"invalid filename" ) ;
67 bool readEnvelope( std::string & reason ,
bool check_for_no_remote_recipients ) ;
75 virtual std::string
name()
const ;
78 virtual std::string
location()
const ;
84 virtual const std::string &
from()
const ;
96 virtual void fail(
const std::string & reason ,
int reason_code ) ;
111 virtual void sync() ;
117 static const std::string & crlf() ;
118 std::string getline( std::istream & stream )
const ;
119 std::string value(
const std::string & s ,
const std::string & k = std::string() )
const ;
121 void readFormat( std::istream & stream ) ;
122 void readFlag( std::istream & stream ) ;
123 void readFrom( std::istream & stream ) ;
124 void readToList( std::istream & stream ) ;
125 void readEnd( std::istream & stream ) ;
126 void readReasons( std::istream & stream ) ;
127 void readAuthentication( std::istream & stream ) ;
128 void readClientSocketAddress( std::istream & stream ) ;
129 void readClientSocketName( std::istream & stream ) ;
130 void readClientCertificate( std::istream & stream ) ;
131 void readEnvelopeCore(
bool ) ;
132 static void addReason(
const G::Path & path ,
const std::string & ,
int ) ;
144 std::auto_ptr<std::istream> m_content ;
146 std::string m_authentication ;
147 std::string m_format ;
148 std::string m_client_socket_address ;
149 std::string m_client_socket_name ;
150 std::string m_client_certificate ;
bool readEnvelope(std::string &reason, bool check_for_no_remote_recipients)
Reads the envelope.
virtual void destroy()
Final override from GSmtp::StoredMessage.
virtual size_t errorCount() const
Final override from GSmtp::StoredMessage.
SMTP and message-store classes.
std::list< std::string > Strings
A std::list of std::strings.
An abstract class for messages which have come from the store.
virtual std::string name() const
Final override from GSmtp::StoredMessage.
virtual bool eightBit() const
Final override from GSmtp::StoredMessage.
virtual void sync()
Final override from GSmtp::StoredMessage.
virtual ~StoredFile()
Destructor.
virtual std::auto_ptr< std::istream > extractContentStream()
Final override from GSmtp::StoredMessage.
virtual const G::Strings & to() const
Final override from GSmtp::StoredMessage.
bool openContent(std::string &reason)
Opens the content file.
A concete derived class implementing the StoredMessage interface.
StoredFile(FileStore &store, const G::Path &envelope_path)
Constructor.
virtual const std::string & from() const
Final override from GSmtp::StoredMessage.
virtual void fail(const std::string &reason, int reason_code)
Final override from GSmtp::StoredMessage.
virtual std::string authentication() const
Final override from GSmtp::StoredMessage.
virtual std::string location() const
Final override from GSmtp::StoredMessage.
virtual void unfail()
Final override from GSmtp::StoredMessage.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
virtual size_t remoteRecipientCount() const
Final override from GSmtp::StoredMessage.
A concrete implementation of the MessageStore interface dealing in paired flat files and with an opti...
bool lock()
Locks the file by renaming the envelope file.
A Path object represents a file system path.