E-MailRelay
gnewmessage.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 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
26namespace GSmtp
27{
28 class NewMessage ;
29 class MessageStoreImp ;
30}
31
32//| \class GSmtp::NewMessage
33/// An abstract class to allow the creation of a new message in
34/// the message store.
35/// \see GSmtp::MessageStore
36///
38{
39public:
40 virtual void addTo( const std::string & to , bool local ) = 0 ;
41 ///< Adds a 'to' address.
42
43 virtual bool addText( const char * , std::size_t ) = 0 ;
44 ///< Adds a line of content, typically ending with CR-LF.
45 ///< Returns false on overflow.
46
47 virtual bool prepare( const std::string & session_auth_id ,
48 const std::string & peer_socket_address , const std::string & peer_certificate ) = 0 ;
49 ///< Prepares to store the message in the message store.
50 ///< Returns true if a local-mailbox only message that
51 ///< has been fully written and needs no commit().
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 std::string location() const = 0 ;
59 ///< Returns the message's unique location.
60
61 virtual MessageId id() const = 0 ;
62 ///< Returns the message's unique identifier.
63
64 bool addTextLine( const std::string & ) ;
65 ///< A convenience function that calls addText() taking
66 ///< a string parameter and adding CR-LF.
67
68 virtual ~NewMessage() = default ;
69 ///< Destructor. Rolls back any prepare()d storage
70 ///< if un-commit()ed.
71} ;
72
73#endif
74
A somewhat opaque identifer for a MessageStore message.
Definition: gmessagestore.h:43
An abstract class to allow the creation of a new message in the message store.
Definition: gnewmessage.h:38
virtual bool 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.
virtual bool addText(const char *, std::size_t)=0
Adds a line of content, typically ending with CR-LF.
virtual void commit(bool strict)=0
Commits the prepare()d message to the store.
virtual ~NewMessage()=default
Destructor.
virtual std::string location() const =0
Returns the message's unique location.
bool addTextLine(const std::string &)
A convenience function that calls addText() taking a string parameter and adding CR-LF.
Definition: gnewmessage.cpp:26
virtual MessageId id() const =0
Returns the message's unique identifier.
SMTP and message-store classes.
Definition: gadminserver.h:39