E-MailRelay
gprotocolmessagestore.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 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 "gsmtp.h"
26 #include "gprotocolmessage.h"
27 #include "gmessagestore.h"
28 #include "gnewmessage.h"
29 #include "gfilter.h"
30 #include "gslot.h"
31 #include <string>
32 #include <memory>
33 
34 namespace GSmtp
35 {
36  class ProtocolMessageStore ;
37 }
38 
39 /// \class GSmtp::ProtocolMessageStore
40 /// A concrete implementation of the ProtocolMessage interface
41 /// that stores incoming messages in the message store.
42 /// \see GSmtp::ProtocolMessageForward
43 ///
45 {
46 public:
47  ProtocolMessageStore( MessageStore & store , unique_ptr<Filter> ) ;
48  ///< Constructor.
49 
50  virtual ~ProtocolMessageStore() ;
51  ///< Destructor.
52 
54  ///< Override from GSmtp::ProtocolMessage.
55 
56  virtual void reset() override ;
57  ///< Override from GSmtp::ProtocolMessage.
58 
59  virtual void clear() override ;
60  ///< Override from GSmtp::ProtocolMessage.
61 
62  virtual bool setFrom( const std::string & from_user , const std::string & ) override ;
63  ///< Override from GSmtp::ProtocolMessage.
64 
65  virtual bool addTo( const std::string & to_user , VerifierStatus to_status ) override ;
66  ///< Override from GSmtp::ProtocolMessage.
67 
68  virtual void addReceived( const std::string & ) override ;
69  ///< Override from GSmtp::ProtocolMessage.
70 
71  virtual bool addText( const char * , size_t ) override ;
72  ///< Override from GSmtp::ProtocolMessage.
73 
74  virtual std::string from() const override ;
75  ///< Override from GSmtp::ProtocolMessage.
76 
77  virtual void process( const std::string & auth_id , const std::string & peer_socket_address ,
78  const std::string & peer_certificate ) override ;
79  ///< Override from GSmtp::ProtocolMessage.
80 
81 private:
82  void operator=( const ProtocolMessageStore & ) ; // not implemented
83  void filterDone( int ) ;
84 
85 private:
86  MessageStore & m_store ;
87  unique_ptr<Filter> m_filter ;
88  unique_ptr<NewMessage> m_new_msg ;
89  std::string m_from ;
91 } ;
92 
93 #endif
94 
SMTP and message-store classes.
Definition: gadminserver.h:39
virtual void reset() override
Override from GSmtp::ProtocolMessage.
virtual G::Slot::Signal4< bool, unsigned long, std::string, std::string > & doneSignal() override
Override from GSmtp::ProtocolMessage.
virtual bool addTo(const std::string &to_user, VerifierStatus to_status) override
Override from GSmtp::ProtocolMessage.
A concrete implementation of the ProtocolMessage interface that stores incoming messages in the messa...
virtual std::string from() const override
Override from GSmtp::ProtocolMessage.
A class which allows SMTP messages to be stored and retrieved.
Definition: gmessagestore.h:43
virtual bool setFrom(const std::string &from_user, const std::string &) override
Override from GSmtp::ProtocolMessage.
ProtocolMessageStore(MessageStore &store, unique_ptr< Filter >)
Constructor.
virtual ~ProtocolMessageStore()
Destructor.
virtual void clear() override
Override from GSmtp::ProtocolMessage.
virtual void process(const std::string &auth_id, const std::string &peer_socket_address, const std::string &peer_certificate) override
Override from GSmtp::ProtocolMessage.
virtual void addReceived(const std::string &) override
Override from GSmtp::ProtocolMessage.
A structure returned by GSmtp::Verifier to describe the status of a 'rcpt-to' recipient.
An interface used by the ServerProtocol class to assemble and process an incoming message...
virtual bool addText(const char *, size_t) override
Override from GSmtp::ProtocolMessage.