E-MailRelay
gstoredmessage.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 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 "gsmtp.h"
26 #include "gstrings.h"
27 #include "gpath.h"
28 
29 namespace GSmtp
30 {
31  class StoredMessage ;
32 }
33 
34 /// \class GSmtp::StoredMessage
35 /// An abstract interface for messages which have come from the store.
36 /// \see GSmtp::MessageStore, GSmtp::MessageStore::get()
37 ///
39 {
40 public:
41  virtual std::string name() const = 0 ;
42  ///< Returns some sort of unique identifier for the message.
43 
44  virtual std::string location() const = 0 ;
45  ///< Returns another sort of unique identifier for the message.
46 
47  virtual const std::string & from() const = 0 ;
48  ///< Returns the envelope 'from' field.
49 
50  virtual const G::StringArray & to() const = 0 ;
51  ///< Returns the envelope 'to' fields.
52 
53  virtual unique_ptr<std::istream> extractContentStream() = 0 ;
54  ///< Extracts the content stream.
55  ///< Can only be called once.
56 
57  virtual void destroy() = 0 ;
58  ///< Deletes the message within the store.
59 
60  virtual void fail( const std::string & reason , int reason_code ) = 0 ;
61  ///< Marks the message as failed within the store.
62 
63  virtual void unfail() = 0 ;
64  ///< Marks the message as unfailed within the store.
65 
66  virtual bool eightBit() const = 0 ;
67  ///< Returns true if the message content (header+body)
68  ///< contains a character with the most significant
69  ///< bit set.
70 
71  virtual std::string authentication() const = 0 ;
72  ///< Returns the original session authentication id.
73 
74  virtual std::string fromAuthIn() const = 0 ;
75  ///< Returns the incoming "mail from" auth parameter,
76  ///< either empty, xtext-encoded or "<>".
77 
78  virtual std::string fromAuthOut() const = 0 ;
79  ///< Returns the outgoing "mail from" auth parameter,
80  ///< either empty, xtext-encoded or "<>".
81 
82  virtual size_t remoteRecipientCount() const = 0 ;
83  ///< Returns the number of non-local recipients.
84 
85  virtual size_t errorCount() const = 0 ;
86  ///< Returns the number of accumulated submission errors.
87 
88  virtual void sync( bool check ) = 0 ;
89  ///< Synchronises the message object with the underlying
90  ///< storage. Optionally performs extra sanity checks if the
91  ///< storage may have been edited.
92 
93  virtual ~StoredMessage() ;
94  ///< Destructor.
95 
96 private:
97  void operator=( const StoredMessage & ) ; // not implemented
98 } ;
99 
100 #endif
101 
virtual std::string authentication() const =0
Returns the original session authentication id.
SMTP and message-store classes.
Definition: gadminserver.h:39
virtual const std::string & from() const =0
Returns the envelope 'from' field.
virtual void unfail()=0
Marks the message as unfailed within the store.
virtual std::string name() const =0
Returns some sort of unique identifier for the message.
virtual const G::StringArray & to() const =0
Returns the envelope 'to' fields.
virtual unique_ptr< std::istream > extractContentStream()=0
Extracts the content stream.
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstrings.h:33
An abstract interface for messages which have come from the store.
virtual ~StoredMessage()
Destructor.
virtual void destroy()=0
Deletes the message within the store.
virtual std::string fromAuthIn() const =0
Returns the incoming "mail from" auth parameter, either empty, xtext-encoded or "<>".
virtual std::string fromAuthOut() const =0
Returns the outgoing "mail from" auth parameter, either empty, xtext-encoded or "<>".
virtual void sync(bool check)=0
Synchronises the message object with the underlying storage.
virtual void fail(const std::string &reason, int reason_code)=0
Marks the message as failed within the store.
virtual size_t errorCount() const =0
Returns the number of accumulated submission errors.
virtual size_t remoteRecipientCount() const =0
Returns the number of non-local recipients.
virtual bool eightBit() const =0
Returns true if the message content (header+body) contains a character with the most significant bit ...
virtual std::string location() const =0
Returns another sort of unique identifier for the message.