E-MailRelay
gstoredmessage.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 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 gstoredmessage.h
19///
20
21#ifndef G_SMTP_STORED_MESSAGE_H
22#define G_SMTP_STORED_MESSAGE_H
23
24#include "gdef.h"
25#include "gstringarray.h"
26#include "gmessagestore.h"
27#include "genvelope.h"
28#include "gpath.h"
29#include <functional>
30#include <iostream>
31#include <fstream>
32
33namespace GStore
34{
35 class StoredMessage ;
36}
37
38//| \class GStore::StoredMessage
39/// An abstract interface for messages which have come from the store.
40/// \see GStore::MessageStore, GStore::MessageStore::get()
41///
43{
44public:
45 virtual MessageId id() const = 0 ;
46 ///< Returns the message identifier.
47
48 virtual std::string location() const = 0 ;
49 ///< Returns the message location.
50
51 virtual std::string from() const = 0 ;
52 ///< Returns the envelope 'from' field.
53
54 virtual std::string to( std::size_t ) const = 0 ;
55 ///< Returns the requested envelope non-local recipient
56 ///< or the empty string if out of range.
57
58 virtual std::size_t toCount() const = 0 ;
59 ///< Returns the number of non-local recipients.
60
61 virtual std::size_t contentSize() const = 0 ;
62 ///< Returns the content size.
63
64 virtual std::istream & contentStream() = 0 ;
65 ///< Returns a reference to the content stream.
66
67 virtual void close() = 0 ;
68 ///< Releases the message to allow external editing.
69
70 virtual std::string reopen() = 0 ;
71 ///< Reverses a close(), returning the empty string
72 ///< on success or an error reason.
73
74 virtual void destroy() = 0 ;
75 ///< Deletes the message within the store.
76
77 virtual void fail( const std::string & reason , int reason_code ) = 0 ;
78 ///< Marks the message as failed within the store.
79
80 virtual MessageStore::BodyType bodyType() const = 0 ;
81 ///< Returns the message body type.
82
83 virtual std::string authentication() const = 0 ;
84 ///< Returns the original session authentication id.
85
86 virtual std::string fromAuthIn() const = 0 ;
87 ///< Returns the incoming "mail from" auth parameter,
88 ///< either empty, xtext-encoded or "<>".
89
90 virtual std::string fromAuthOut() const = 0 ;
91 ///< Returns the outgoing "mail from" auth parameter,
92 ///< either empty, xtext-encoded or "<>".
93
94 virtual std::string forwardTo() const = 0 ;
95 ///< Returns the routing override or the empty string.
96
97 virtual std::string forwardToAddress() const = 0 ;
98 ///< Returns the forwardTo() address or the empty string.
99
100 virtual std::string clientAccountSelector() const = 0 ;
101 ///< Returns the client account selector or the empty string.
102
103 virtual bool utf8Mailboxes() const = 0 ;
104 ///< Returns true if the mail-from command should
105 ///< have SMTPUTF8 (RFC-6531).
106
107 virtual void editRecipients( const G::StringArray & ) = 0 ;
108 ///< Updates the message's remote recipients, typically to
109 ///< the sub-set that have not received it successfully.
110
111 virtual ~StoredMessage() = default ;
112 ///< Destructor.
113} ;
114
115#endif
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
An abstract interface for messages which have come from the store.
virtual std::string forwardToAddress() const =0
Returns the forwardTo() address or the empty string.
virtual void destroy()=0
Deletes the message within the store.
virtual void fail(const std::string &reason, int reason_code)=0
Marks the message as failed within the store.
virtual std::istream & contentStream()=0
Returns a reference to the content stream.
virtual std::string to(std::size_t) const =0
Returns the requested envelope non-local recipient or the empty string if out of range.
virtual std::string from() const =0
Returns the envelope 'from' field.
virtual std::string clientAccountSelector() const =0
Returns the client account selector or the empty string.
virtual void editRecipients(const G::StringArray &)=0
Updates the message's remote recipients, typically to the sub-set that have not received it successfu...
virtual void close()=0
Releases the message to allow external editing.
virtual std::string reopen()=0
Reverses a close(), returning the empty string on success or an error reason.
virtual std::size_t contentSize() const =0
Returns the content size.
virtual std::string location() const =0
Returns the message location.
virtual std::string fromAuthOut() const =0
Returns the outgoing "mail from" auth parameter, either empty, xtext-encoded or "<>".
virtual std::string fromAuthIn() const =0
Returns the incoming "mail from" auth parameter, either empty, xtext-encoded or "<>".
virtual MessageStore::BodyType bodyType() const =0
Returns the message body type.
virtual std::string authentication() const =0
Returns the original session authentication id.
virtual MessageId id() const =0
Returns the message identifier.
virtual std::size_t toCount() const =0
Returns the number of non-local recipients.
virtual ~StoredMessage()=default
Destructor.
virtual std::string forwardTo() const =0
Returns the routing override or the empty string.
virtual bool utf8Mailboxes() const =0
Returns true if the mail-from command should have SMTPUTF8 (RFC-6531).
Message store classes.
Definition: genvelope.cpp:30
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstringarray.h:30