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
33 namespace 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///
43 class GSmtp::ProtocolMessageStore : public ProtocolMessage
44{
45 public:
46 ProtocolMessageStore( GStore::MessageStore & store ,
47 std::unique_ptr<Filter> ) ;
48 ///< Constructor.
49
50 ~ProtocolMessageStore() override ;
51 ///< Destructor.
52
53 private: // 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
68 public:
69 ProtocolMessageStore( const ProtocolMessageStore & ) = delete ;
70 ProtocolMessageStore( ProtocolMessageStore && ) = delete ;
71 ProtocolMessageStore & operator=( const ProtocolMessageStore & ) = delete ;
72 ProtocolMessageStore & operator=( ProtocolMessageStore && ) = delete ;
73
74 private:
75 void filterDone( int ) ;
76
77 private:
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
GSmtp::ProtocolMessageStore
A concrete implementation of the ProtocolMessage interface that stores incoming messages in the messa...
Definition: gprotocolmessagestore.h:44
GSmtp::ProtocolMessageStore::ProtocolMessageStore
ProtocolMessageStore(GStore::MessageStore &store, std::unique_ptr< Filter >)
Constructor.
Definition: gprotocolmessagestore.cpp:28
GSmtp::ProtocolMessageStore::~ProtocolMessageStore
~ProtocolMessageStore() override
Destructor.
Definition: gprotocolmessagestore.cpp:36
GSmtp::ProtocolMessage
An interface used by the ServerProtocol class to assemble and process an incoming message.
Definition: gprotocolmessage.h:65
GStore::MessageId
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
GStore::MessageStore
A class which allows SMTP messages to be stored and retrieved.
Definition: gmessagestore.h:73
gfilter.h
gmessagestore.h
gnewmessage.h
gprotocolmessage.h
gslot.h
GSmtp
SMTP classes.
Definition: gadminserver.h:42
GSmtp::ProtocolMessage::FromInfo
Extra information from the SMTP MAIL-FROM command passed to GSmtp::ProtocolMessage::setFrom().
Definition: gprotocolmessage.h:78
GSmtp::ProtocolMessage::ToInfo
Extra information passed to GSmtp::ProtocolMessage::addTo().
Definition: gprotocolmessage.h:85
G::Slot::Signal< const ProcessedInfo & >