- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
56 class GSmtp::ProtocolMessageForward : public GSmtp::ProtocolMessage
57 {
58 public:
59 ProtocolMessageForward( MessageStore & store ,
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
71 virtual G::Signal3<bool,unsigned long,std::string> & doneSignal() ;
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:
100 G::Signal3<bool,unsigned long,std::string> & storageDoneSignal() ;
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 ;
123 GNet::ClientPtr<GSmtp::Client> m_client ;
124 unsigned long m_id ;
125 unsigned int m_connection_timeout ;
126 G::Signal3<bool,unsigned long,std::string> m_done_signal ;
127 } ;
128
129 #endif
gprotocolmessagestore.h
GSmtp::ProtocolMessageForward::storageDoneSignal
G::Signal3< bool, unsigned long, std::string > & storageDoneSignal()
Returns the signal which is used to signal that the storage is complete.
Definition: gprotocolmessageforward.cpp:61
GSmtp
SMTP and message-store classes.
GSmtp::ProtocolMessageForward::addText
virtual bool addText(const std::string &)
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:97
GSmtp::ProtocolMessageForward::processDone
void processDone(bool, unsigned long, std::string)
Called by derived classes that have intercepted the storageDoneSignal() when their own post-storage p...
Definition: gprotocolmessageforward.cpp:114
GSmtp::ProtocolMessageForward::clear
virtual void clear()
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:77
GSmtp::ProtocolMessageForward
A concrete implementation of the ProtocolMessage interface which stores incoming messages in the mess...
Definition: gprotocolmessageforward.h:56
GSmtp::ProtocolMessageForward::addReceived
virtual void addReceived(const std::string &)
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:92
gresolverinfo.h
gverifierstatus.h
gprotocolmessage.h
GNet::ResolverInfo
A class that holds a host/service name pair and optionally the results of a name-to-address lookup...
Definition: gresolverinfo.h:48
gexecutable.h
GSmtp::ProtocolMessageForward::setFrom
virtual bool setFrom(const std::string &from_user)
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:82
gsecrets.h
GSmtp::MessageStore
A class which allows SMTP messages (envelope+content) to be stored and retrieved. ...
Definition: gmessagestore.h:45
GAuth::Secrets
A simple interface to a store of secrets as used in authentication.
Definition: gsecrets.h:44
gclientptr.h
gmessagestore.h
GSmtp::ProtocolMessageForward::ProtocolMessageForward
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.
Definition: gprotocolmessageforward.cpp:33
GSmtp::Client::Config
A structure containing GSmtp::Client configuration parameters.
Definition: gsmtpclient.h:61
G::Signal3< bool, unsigned long, std::string >
GSmtp::VerifierStatus
A structure returned by GSmtp::Verifier to describe the status of a rcpt-to recipient.
Definition: gverifierstatus.h:51
GSmtp::ProtocolMessage
An interface used by the ServerProtocol class to assemble and process an incoming message...
Definition: gprotocolmessage.h:64
GNet::ClientPtr< GSmtp::Client >
GSmtp::ProtocolMessageForward::doneSignal
virtual G::Signal3< bool, unsigned long, std::string > & doneSignal()
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:66
gsmtp.h
gsmtpclient.h
GSmtp::ProtocolMessageForward::process
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.
Definition: gprotocolmessageforward.cpp:107
GSmtp::ProtocolMessageForward::from
virtual std::string from() const
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:102
GSmtp::ProtocolMessageForward::addTo
virtual bool addTo(const std::string &to_user, VerifierStatus to_status)
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:87
gnewmessage.h
GSmtp::ProtocolMessageForward::reset
virtual void reset()
Final override from GSmtp::ProtocolMessage.
Definition: gprotocolmessageforward.cpp:71
GSmtp::ProtocolMessageForward::~ProtocolMessageForward
virtual ~ProtocolMessageForward()
Destructor.
Definition: gprotocolmessageforward.cpp:53