E-MailRelay
gprotocolmessagestore.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 gprotocolmessagestore.h
19///
20
21#ifndef G_SMTP_PROTOCOL_MESSAGE_STORE_H
22#define G_SMTP_PROTOCOL_MESSAGE_STORE_H
23
24#include "gdef.h"
25#include "gprotocolmessage.h"
26#include "gmessagestore.h"
27#include "gnewmessage.h"
28#include "gfilter.h"
29#include "gslot.h"
30#include <string>
31#include <memory>
32
33namespace GSmtp
34{
35 class ProtocolMessageStore ;
36}
37
38//| \class GSmtp::ProtocolMessageStore
39/// A concrete implementation of the ProtocolMessage interface
40/// that stores incoming messages in the message store.
41/// \see GSmtp::ProtocolMessageForward
42///
44{
45public:
47 std::unique_ptr<Filter> ) ;
48 ///< Constructor.
49
50 ~ProtocolMessageStore() override ;
51 ///< Destructor.
52
53private: // overrides
54 ProtocolMessage::ProcessedSignal & processedSignal() noexcept override ; // GSmtp::ProtocolMessage
55 void reset() override ; // GSmtp::ProtocolMessage
56 void clear() override ; // GSmtp::ProtocolMessage
57 GStore::MessageId setFrom( const std::string & , const FromInfo & ) override ; // GSmtp::ProtocolMessage
58 bool addTo( const ToInfo & ) override ; // GSmtp::ProtocolMessage
59 void addReceived( const std::string & ) override ; // GSmtp::ProtocolMessage
60 GStore::NewMessage::Status addContent( const char * , std::size_t ) override ; // GSmtp::ProtocolMessage
61 std::size_t contentSize() const override ; // GSmtp::ProtocolMessage
62 std::string from() const override ; // GSmtp::ProtocolMessage
63 ProtocolMessage::FromInfo fromInfo() const override ; // GSmtp::ProtocolMessage
64 std::string bodyType() const override ; // GSmtp::ProtocolMessage
65 void process( const std::string & auth_id , const std::string & peer_socket_address ,
66 const std::string & peer_certificate ) override ; // GSmtp::ProtocolMessage
67
68public:
69 ProtocolMessageStore( const ProtocolMessageStore & ) = delete ;
71 ProtocolMessageStore & operator=( const ProtocolMessageStore & ) = delete ;
72 ProtocolMessageStore & operator=( ProtocolMessageStore && ) = delete ;
73
74private:
75 void filterDone( int ) ;
76
77private:
78 GStore::MessageStore & m_store ;
79 std::unique_ptr<Filter> m_filter ;
80 std::unique_ptr<GStore::NewMessage> m_new_msg ;
81 std::string m_from ;
82 FromInfo m_from_info ;
83 ProtocolMessage::ProcessedSignal m_processed_signal ;
84} ;
85
86#endif
87
A concrete implementation of the ProtocolMessage interface that stores incoming messages in the messa...
ProtocolMessageStore(GStore::MessageStore &store, std::unique_ptr< Filter >)
Constructor.
~ProtocolMessageStore() override
Destructor.
An interface used by the ServerProtocol class to assemble and process an incoming message.
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
A class which allows SMTP messages to be stored and retrieved.
Definition: gmessagestore.h:73
SMTP classes.
Definition: gadminserver.h:42
Extra information from the SMTP MAIL-FROM command passed to GSmtp::ProtocolMessage::setFrom().
Extra information passed to GSmtp::ProtocolMessage::addTo().