E-MailRelay
gprotocolmessagestore.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 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:
46 ProtocolMessageStore( MessageStore & store , std::unique_ptr<Filter> ) ;
47 ///< Constructor.
48
49 ~ProtocolMessageStore() override ;
50 ///< Destructor.
51
53 ///< Override from GSmtp::ProtocolMessage.
54
55 void reset() override ;
56 ///< Override from GSmtp::ProtocolMessage.
57
58 void clear() override ;
59 ///< Override from GSmtp::ProtocolMessage.
60
61 MessageId setFrom( const std::string & from_user , const std::string & ) override ;
62 ///< Override from GSmtp::ProtocolMessage.
63
64 bool addTo( VerifierStatus to_status ) override ;
65 ///< Override from GSmtp::ProtocolMessage.
66
67 void addReceived( const std::string & ) override ;
68 ///< Override from GSmtp::ProtocolMessage.
69
70 bool addText( const char * , std::size_t ) override ;
71 ///< Override from GSmtp::ProtocolMessage.
72
73 std::string from() const override ;
74 ///< Override from GSmtp::ProtocolMessage.
75
76 void process( const std::string & auth_id , const std::string & peer_socket_address ,
77 const std::string & peer_certificate ) override ;
78 ///< Override from GSmtp::ProtocolMessage.
79
80public:
81 ProtocolMessageStore( const ProtocolMessageStore & ) = delete ;
83 void operator=( const ProtocolMessageStore & ) = delete ;
84 void operator=( ProtocolMessageStore && ) = delete ;
85
86private:
87 void filterDone( int ) ;
88
89private:
90 MessageStore & m_store ;
91 std::unique_ptr<Filter> m_filter ;
92 std::unique_ptr<NewMessage> m_new_msg ;
93 std::string m_from ;
94 ProtocolMessage::DoneSignal m_done_signal ;
95} ;
96
97#endif
98
A somewhat opaque identifer for a MessageStore message.
Definition: gmessagestore.h:43
A class which allows SMTP messages to be stored and retrieved.
Definition: gmessagestore.h:73
A concrete implementation of the ProtocolMessage interface that stores incoming messages in the messa...
void clear() override
Override from GSmtp::ProtocolMessage.
ProtocolMessage::DoneSignal & doneSignal() override
Override from GSmtp::ProtocolMessage.
void reset() override
Override from GSmtp::ProtocolMessage.
~ProtocolMessageStore() override
Destructor.
std::string from() const override
Override from GSmtp::ProtocolMessage.
ProtocolMessageStore(MessageStore &store, std::unique_ptr< Filter >)
Constructor.
void process(const std::string &auth_id, const std::string &peer_socket_address, const std::string &peer_certificate) override
Override from GSmtp::ProtocolMessage.
void addReceived(const std::string &) override
Override from GSmtp::ProtocolMessage.
bool addTo(VerifierStatus to_status) override
Override from GSmtp::ProtocolMessage.
MessageId setFrom(const std::string &from_user, const std::string &) override
Override from GSmtp::ProtocolMessage.
bool addText(const char *, std::size_t) override
Override from GSmtp::ProtocolMessage.
An interface used by the ServerProtocol class to assemble and process an incoming message.
A structure returned by GSmtp::Verifier to describe the status of a 'rcpt-to' or 'vrfy' recipient.
SMTP and message-store classes.
Definition: gadminserver.h:39