gprotocolmessageforward.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 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 // ===
20 
21 #ifndef G_SMTP_PROTOCOL_MESSAGE_FORWARD_H
22 #define G_SMTP_PROTOCOL_MESSAGE_FORWARD_H
23 
24 #include "gdef.h"
25 #include "gsmtp.h"
26 #include "gresolverinfo.h"
27 #include "gclientptr.h"
28 #include "gprotocolmessage.h"
29 #include "gprotocolmessagestore.h"
30 #include "gexecutable.h"
31 #include "gsecrets.h"
32 #include "gsmtpclient.h"
33 #include "gmessagestore.h"
34 #include "gnewmessage.h"
35 #include "gverifierstatus.h"
36 #include <string>
37 #include <memory>
38 
40 namespace GSmtp
41 {
42  class ProtocolMessageForward ;
43 }
44 
57 {
58 public:
60  std::auto_ptr<ProtocolMessage> pm ,
61  const GSmtp::Client::Config & client_config ,
62  const GAuth::Secrets & client_secrets ,
63  const std::string & server_address ,
64  unsigned int connection_timeout ) ;
67 
68  virtual ~ProtocolMessageForward() ;
70 
73 
74  virtual void reset() ;
76 
77  virtual void clear() ;
79 
80  virtual bool setFrom( const std::string & from_user ) ;
82 
83  virtual bool addTo( const std::string & to_user , VerifierStatus to_status ) ;
85 
86  virtual void addReceived( const std::string & ) ;
88 
89  virtual bool addText( const std::string & ) ;
91 
92  virtual std::string from() const ;
94 
95  virtual void process( const std::string & auth_id, const std::string & peer_socket_address ,
96  const std::string & peer_socket_name , const std::string & peer_certificate ) ;
98 
99 protected:
105 
106  void processDone( bool , unsigned long , std::string ) ;
110 
111 private:
112  void operator=( const ProtocolMessageForward & ) ; // not implemented
113  void clientDone( std::string , bool ) ; // GNet::Client::doneSignal()
114  void messageDone( std::string ) ; // GSmtp::Client::messageDoneSignal()
115  bool forward( unsigned long , bool & , std::string * ) ;
116 
117 private:
118  MessageStore & m_store ;
119  GNet::ResolverInfo m_client_resolver_info ;
120  Client::Config m_client_config ;
121  const GAuth::Secrets & m_client_secrets ;
122  std::auto_ptr<ProtocolMessage> m_pm ;
124  unsigned long m_id ;
125  unsigned int m_connection_timeout ;
127 } ;
128 
129 #endif
G::Signal3< bool, unsigned long, std::string > & storageDoneSignal()
Returns the signal which is used to signal that the storage is complete.
SMTP and message-store classes.
virtual bool addText(const std::string &)
Final override from GSmtp::ProtocolMessage.
void processDone(bool, unsigned long, std::string)
Called by derived classes that have intercepted the storageDoneSignal() when their own post-storage p...
virtual void clear()
Final override from GSmtp::ProtocolMessage.
A concrete implementation of the ProtocolMessage interface which stores incoming messages in the mess...
virtual void addReceived(const std::string &)
Final override from GSmtp::ProtocolMessage.
A class that holds a host/service name pair and optionally the results of a name-to-address lookup...
Definition: gresolverinfo.h:48
virtual bool setFrom(const std::string &from_user)
Final override from GSmtp::ProtocolMessage.
A class which allows SMTP messages (envelope+content) to be stored and retrieved. ...
Definition: gmessagestore.h:45
A simple interface to a store of secrets as used in authentication.
Definition: gsecrets.h:44
ProtocolMessageForward(MessageStore &store, std::auto_ptr< ProtocolMessage > pm, const GSmtp::Client::Config &client_config, const GAuth::Secrets &client_secrets, const std::string &server_address, unsigned int connection_timeout)
Constructor.
A structure containing GSmtp::Client configuration parameters.
Definition: gsmtpclient.h:61
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 G::Signal3< bool, unsigned long, std::string > & doneSignal()
Final override from GSmtp::ProtocolMessage.
virtual void process(const std::string &auth_id, const std::string &peer_socket_address, const std::string &peer_socket_name, const std::string &peer_certificate)
Final override from GSmtp::ProtocolMessage.
virtual std::string from() const
Final override from GSmtp::ProtocolMessage.
virtual bool addTo(const std::string &to_user, VerifierStatus to_status)
Final override from GSmtp::ProtocolMessage.
virtual void reset()
Final override from GSmtp::ProtocolMessage.
virtual ~ProtocolMessageForward()
Destructor.