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
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( MessageStore & store , std::unique_ptr<Filter> ) ;
47 ///< Constructor.
48
49 ~ProtocolMessageStore() override ;
50 ///< Destructor.
51
52 ProtocolMessage::DoneSignal & doneSignal() override ;
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
80 public:
81 ProtocolMessageStore( const ProtocolMessageStore & ) = delete ;
82 ProtocolMessageStore( ProtocolMessageStore && ) = delete ;
83 void operator=( const ProtocolMessageStore & ) = delete ;
84 void operator=( ProtocolMessageStore && ) = delete ;
85
86 private:
87 void filterDone( int ) ;
88
89 private:
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
GSmtp::MessageId
A somewhat opaque identifer for a MessageStore message.
Definition: gmessagestore.h:43
GSmtp::MessageStore
A class which allows SMTP messages to be stored and retrieved.
Definition: gmessagestore.h:73
GSmtp::ProtocolMessageStore
A concrete implementation of the ProtocolMessage interface that stores incoming messages in the messa...
Definition: gprotocolmessagestore.h:44
GSmtp::ProtocolMessageStore::clear
void clear() override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:46
GSmtp::ProtocolMessageStore::doneSignal
ProtocolMessage::DoneSignal & doneSignal() override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:202
GSmtp::ProtocolMessageStore::reset
void reset() override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:40
GSmtp::ProtocolMessageStore::~ProtocolMessageStore
~ProtocolMessageStore() override
Destructor.
Definition: gprotocolmessagestore.cpp:35
GSmtp::ProtocolMessageStore::from
std::string from() const override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:106
GSmtp::ProtocolMessageStore::ProtocolMessageStore
ProtocolMessageStore(MessageStore &store, std::unique_ptr< Filter >)
Constructor.
Definition: gprotocolmessagestore.cpp:28
GSmtp::ProtocolMessageStore::process
void process(const std::string &auth_id, const std::string &peer_socket_address, const std::string &peer_certificate) override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:111
GSmtp::ProtocolMessageStore::addReceived
void addReceived(const std::string &) override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:91
GSmtp::ProtocolMessageStore::addTo
bool addTo(VerifierStatus to_status) override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:70
GSmtp::ProtocolMessageStore::setFrom
MessageId setFrom(const std::string &from_user, const std::string &) override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:54
GSmtp::ProtocolMessageStore::addText
bool addText(const char *, std::size_t) override
Override from GSmtp::ProtocolMessage.
Definition: gprotocolmessagestore.cpp:98
GSmtp::ProtocolMessage
An interface used by the ServerProtocol class to assemble and process an incoming message.
Definition: gprotocolmessage.h:64
GSmtp::VerifierStatus
A structure returned by GSmtp::Verifier to describe the status of a 'rcpt-to' or 'vrfy' recipient.
Definition: gverifierstatus.h:52
gfilter.h
gmessagestore.h
gnewmessage.h
gprotocolmessage.h
gslot.h
GSmtp
SMTP and message-store classes.
Definition: gadminserver.h:39
G::Slot::Signal< bool, const MessageId &, const std::string &, const std::string & >