E-MailRelay
gnewmessage.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gnewmessage.h
19 ///
20 
21 #ifndef G_SMTP_NEW_MESSAGE_H
22 #define G_SMTP_NEW_MESSAGE_H
23 
24 #include "gdef.h"
25 #include "gsmtp.h"
26 
27 namespace GSmtp
28 {
29  class NewMessage ;
30  class MessageStoreImp ;
31 }
32 
33 /// \class GSmtp::NewMessage
34 /// An abstract class to allow the creation of a new message in
35 /// the message store.
36 /// \see GSmtp::MessageStore, GSmtp::MessageStore::newMessage()
37 ///
39 {
40 public:
41  virtual void addTo( const std::string & to , bool local ) = 0 ;
42  ///< Adds a 'to' address.
43 
44  virtual bool addText( const char * , size_t ) = 0 ;
45  ///< Adds a line of content. The line should not include the
46  ///< line ending. Returns false on overflow.
47 
48  virtual std::string prepare( const std::string & session_auth_id ,
49  const std::string & peer_socket_address , const std::string & peer_certificate ) = 0 ;
50  ///< Prepares to store the message in the message store.
51  ///< Returns the location of the pre-commit()ed message.
52 
53  virtual void commit( bool strict ) = 0 ;
54  ///< Commits the prepare()d message to the store. Errors are
55  ///< ignored (eg. missing files) if the 'strict' parameter
56  ///< is false.
57 
58  virtual unsigned long id() const = 0 ;
59  ///< Returns the message's unique non-zero identifier.
60 
61  bool addTextLine( const std::string & ) ;
62  ///< A convenience function that calls addText() taking
63  ///< a string parameter.
64 
65  virtual ~NewMessage() ;
66  ///< Destructor. Rolls back any prepare()d storage
67  ///< if un-commit()ed.
68 
69 private:
70  void operator=( const NewMessage & ) ; // not implemented
71 } ;
72 
73 #endif
74 
SMTP and message-store classes.
Definition: gadminserver.h:39
virtual void commit(bool strict)=0
Commits the prepare()d message to the store.
bool addTextLine(const std::string &)
A convenience function that calls addText() taking a string parameter.
Definition: gnewmessage.cpp:31
virtual ~NewMessage()
Destructor.
Definition: gnewmessage.cpp:27
virtual std::string 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.
virtual void addTo(const std::string &to, bool local)=0
Adds a 'to' address.
An abstract class to allow the creation of a new message in the message store.
Definition: gnewmessage.h:38
virtual bool addText(const char *, size_t)=0
Adds a line of content.
virtual unsigned long id() const =0
Returns the message's unique non-zero identifier.